C # WinForm uses the override CreateParams to override some of the form's features

Source: Internet
Author: User

The properties of the form and control CreateParams ( which is really a property ) are magical, because it makes it easy for you to control some of the features of a form or control such as a border, the ability to minimize the hide of the Close button, the modal popup mode of the form, and so on. Although the createparams has such great potential, it is very discreet when used, and if you do not understand the CreateParams attribute, you will be very confused when writing other code.

Refer to the description of CreateParams in MSDN:

do not override this property in the overloaded control you are developing, and control some of the style of the control with this property. Use this property only if you are encapsulating Windows controls or want to implement some style (such as layered Window) control that some WinForm do not provide. For more information, refer to the documentation comments on MSDN for the CreateWindow method and the parameters of the CreateWindowEx method createstruct structure.

Briefly explain why CreateParams can achieve such advanced style control, since the names of CreateWindow and CreateWindowEx show that Createparam is a parameter passed to both methods, These two methods are also called when the form is created. So, Createparam can achieve such a powerful style control.

In the process of developing winform in net, we sometimes need to make some special settings for form forms, such as:
Hide the main form, showing only the taskbar icon in the lower-right corner
The "Hide main form" Above has several implementations, but the most perfect and thorough method is to override the CreateParams event of the base class form.

Override createparams CreateParams {      get      {          falsebase. CreateParams; } }
The above code is the implementation, very simple and effective, debugging run, do not see a form (because the form's visible visual property is set to False, that is, the form is not visible). However, the form's event Form_Load, Form_shown, form_paint, etc. are still available.
Reprint: http://www.cnblogs.com/JuneZhang/archive/2012/07/06/2579058.html

C # WinForm uses the override CreateParams to override some of the form's features

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.