This article is a mirror article of machine translation, please click here to jump to the original article.

View: 15969|Reply: 1

[WinForm] WinForm implements a full-screen approach

[Copy link]
Posted on 3/9/2016 5:05:11 PM | | |

1. Realize the full-screen display of the form

Method: Do the following in the 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 certain control in the form

Method: For example, to display the richtextbox control in full screen, the operation is 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 the full screen and restore the original appearance

Method: The premise is to define a class member variable to save the original size of the control to be full-screen, and then initialize it to the original size of the control in the constructor

In the exit full-screen method, the operation is as follows

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;




Previous:C# determines whether a string is a URL or not
Next:C# drag and drop files to show the file path
 Landlord| Posted on 3/9/2016 5:07:39 PM |
Rectangle ScreenArea = System.Windows.Forms.Screen.GetBounds(this) This gets the height includes the taskbar The height of the screen is 1080 The height of the above method is 1050
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com