Winform full screen problem summary

Source: Internet
Author: User

1.
Execute the following button event
Private void btnformmax_click (Object sender, eventargs E)
{
If (this. windowstate = formwindowstate. maximized)
{
This. windowstate = formwindowstate. normal;
}
Else
{
This. windowstate = formwindowstate. maximized;
}
}
When the form is maximized, the taskbar is not covered in full screen mode.
This. formborderstyle is sizable by default.

2.
Execute the following button event
Private void btnformmax_click (Object sender, eventargs E)
{
If (this. windowstate = formwindowstate. maximized)
{
This. windowstate = formwindowstate. normal;
}
Else
{
This. formborderstyle = formborderstyle. None;
This. windowstate = formwindowstate. maximized;
}
}

When the form is maximized, the full screen and the taskbar are overwritten.
In this case, if this. formborderstyle is set to none, related information such as the form title bar is not displayed.

3.
Execute the following button event
Private void btnformmax_click (Object sender, eventargs E)
{
If (this. windowstate = formwindowstate. maximized)
{
This. windowstate = formwindowstate. normal;
}
Else
{
This. formborderstyle = formborderstyle. None;
This. maximumsize = new size (screen. primaryscreen. workingarea. Width, screen. primaryscreen. workingarea. Height );
This. windowstate = formwindowstate. maximized;
}
}

When the form is maximized, the full screen does not cover the taskbar.
In this case, if this. formborderstyle is set to none, related information such as the form title bar is not displayed.

 

Setting full screen is to set the windowstate attribute and formwindowstate attribute of the form, as shown in the simple code found on the internet above. However, in actual process, the display of the status bar cannot be controlled, sometimes, the task bar is hidden, but it does not work. The experiment is summarized as follows:

// 1. The maximization operation must first formborderstyle. None and then formwindowstate. maximized. // otherwise, the taskbar cannot be overwritten. // 2. If formwindowstate. maximized is already in use, you must first set it to a status other than formwindowstate. maximized. // otherwise, formwindowstate. maximized does not work and violates the content. If (this. windowstate = formwindowstate. maximized) {This. hide (); this. windowstate = formwindowstate. normal;} This. formborderstyle = formborderstyle. none; this. windowstate = formwindowstate. maximized; this. show ();

In fact, formborderstyle. None also affects the value of a series of properties in winform, such as screen. primaryscreen. workingarea, used to obtain the available screen range.

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.