Some uses of Winform in asp.net

Source: Internet
Author: User

1. Form default Full-screen _load event Add:

This. WindowState = formwindowstate.maximized;

2. Set the specific location where the form appears

Forms form = new form ();     
Form. StartPosition = formstartposition.manual;
Form. Location = new Point (0);
Form. Show ();    
3. Prevent WinForm form Moving : When the form is loaded, record the position of the form, and when the form is moved, assign the previous value to it so that it does not move.
In the process of dragging the mouse, there is still a frame of the form moving along with it. Use the message mechanism to implement. In that case, there would be no such phenomenon.
 	#region prevent forms from moving public
        const int wm_syscommand = 0x112;
        public const int sc_move = 0xf012;
        protected override void WndProc (ref message   m)
        {
            if (m.msg = = Wm_syscommand)
            {if (
                (int) m. WParam = = Sc_move) return
                    ;
            Base. WndProc (ref   m);
        }
        #endregion


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.