I'm developing a reusable UserControl that among other features should provide a full screen mode.
But how to accomplish this?
Typically, the container form should be maximized, not the UserControl.
Is there any way to force a UserControl to temporary occupy the entire screen?
I understand this is not something that should be normally done, but I have reasons to make it this way.
Temporarily move the control to a new borderless form and make that form full screen.
You should be able to re-use the control by removing it from it's container, and then create a full screen, borderless form.
private void OnGoFullScreenMode()
{
this.Controls.Remove(goLiveControl);
this.ShowFullScreen(goLiveControl);
}
private void ShowFullScreen(UserControl userControl)
{
Form fullScreenForm = new Form();
fullScreenForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
fullScreenForm.WindowState = FormWindowState.Maximized;
fullScreenForm.ShowInTaskbar = false;
userControl.Dock = DockStyle.Fill;
fullScreenForm.Controls.Add(userControl);
fullScreenForm.Show();
}
You can make a temporary window from within the usercontrol to provide fullscreen.