WinForm Implement Full-screen method

Source: Internet
Author: User

1, the Realization form full screen display

Method: Do the following in a Full-screen method

This. FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;

This. WindowState = System.Windows.Forms.FormWindowState.Maximized;

2. Realize the full screen display of a control in the window body

Method: For example, to display the RichTextBox control in full screen, as follows (this is the current form)

This. FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
This. windowstate=formwindowstate.maximized;
Rectangle ret = Screen.getworkingarea (this);

This.richTextBox2.ClientSize = new Size (ret. Width, ret. Height);
This.richTextBox2.Dock = DockStyle.Fill;
This.richTextBox2.BringToFront ();

3, exit full screen, restore original appearance

Method: The prerequisite is to define a class member variable to hold the original size (size) of the control you want to Full-screen, and then initialize it within the constructor to the control's original size

In the exit Full-screen method, the following actions

This. FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable;
This. WindowState = Formwindowstate.normal;
This.richTextBox2.ClientSize = Primarysize;//primarysize is the original size of the control
This.richTextBox2.Dock = Dockstyle.none;

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.