C # Winform: Fullscreen UserControl

I have an application with the main form. the main form has a menu, and some toolbars and one user control set up a docking station for filling. how can I provide a full screen so that the user control is set to full screen and all the menus and toolbars are hidden from the main form.

+4
source share
3 answers

Not that I ever did this - my approach would be:

In full screen mode, do the following:

turn off the form border set the controlbox to false (get rid of the title menu and the upper left window) make the / toolstrip menu invisible.

This is done using the Visibility property of these controls.

Now you can set the maximum state of the form window.

EDIT - Code Example:

Paste this into the new forms application code file

public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { this.ControlBox = false; this.FormBorderStyle = FormBorderStyle.None; this.WindowState = FormWindowState.Maximized; } private void Form1_KeyDown(object sender, KeyEventArgs e) { //example of how to programmatically reverse the full-screen. //(You will have to add the event handler for KeyDown for this to work) //if you are using a Key event handler, then you should set the //form KeyPreview property to true so that it works when focus //is on a child control. if (e.KeyCode == Keys.Escape) { this.ControlBox = true; this.FormBorderStyle = FormBorderStyle.Sizable; this.WindowState = FormWindowState.Normal; } } } 
+3
source

In addition to this, before maximizing, do the following:

this.TopMost = true;

... to take control of the bottom pane of the window and the start button (basically it will fill the entire screen).

+1
source

I would programmatically change the user interface, hiding all panels of the container, except for the container panel of the workspace where the user control is located.

0
source

Source: https://habr.com/ru/post/1309291/


All Articles