Windows Forms programming in C # Reading Notes-Chapter 2 forms

Source: Internet
Author: User
1. When the program exits, a dialog box is displayed for the user to confirm (record the position and size of the window when the last program is running)

Add the closing and closed event handling methods for the corresponding form

Private void form1_closing (Object sender, system. componentmodel. canceleventargs E)

{

Dialogresult res = MessageBox. Show ("are you sure you want to exit? "," Exit ", messageboxbuttons. yesno );

E. Cancel = (RES = dialogresult. No );

}


Private void formpolicclosed (Object sender, system. eventargs E)

{

MessageBox. Show ("Thank you for using ");

}

Note: In the closing or closed event processing method, it can be used to record the status of the form for future use (such as the current window position and size)

2. Various sizes and locations in Form


Clientsize does not include title bars, borders, etc.

The specified toplocation does not contain the taskbar.

Bytes --------------------------------------------------------------------------------------------------------------

PS: Today is the Lantern Festival, where the firecrackers are outside ):).Windows Forms programming in C #(AuthorChris sells, Addison Wesley press, 2003.8.),I am reading an English CHM electronic version, which is also my first seriousReadI think this book is really good, and it is clear and easy to understand. Examples and explanations are also excellent. (Read this book to prepare for completing the assignment of the object-oriented technology course this semester. It is estimated that most people will c ++ and a few Java, C # Should look special ^_^)

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.