How does Windows Mobile destroy forms rather than hide them)

Source: Internet
Author: User
On Windows Mobile forms, there are two buttons: "OK" and "X.

1. In form attributes, if "minimizebox = false" is set, the form is displayed with "OK". Click this button to destroy and exit the form. 2. Set "minimizebox = true ", the form displays "X" and click this button. The form is hidden but not destroyed. However, sometimes we want to destroy the form when we click the "X" button, instead of hiding the form, so how to implement it? First, when you click the "X" button, the closed method of the form is not stimulated, so we cannot destroy the form in this method, but we can implement it in another way. When you click the "X" button, the form is hidden, so the focus of the form is lost. There are two kinds of events: 1) lostfocus event; 2) deactivate event; we only need to destroy the form in the methods triggered by these two events to truly exit rather than hide the form. The implementation steps are as follows: 1) Add the following code to the form constructor: This. deactivate + = new system. eventhandler (this. form_closed); or this. lostfocus + = new system. eventhandler (this. form_closed); 2) in the Form class, add the method code: Private void form_closed (Object sender, eventargs e) {This. dispose ();} according to the above description, We can click "X" to destroy the form rather than hide the form. I hope this article will help you. This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/doubleblue/archive/2009/04/16/4083273.aspx
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.