[RESOLVED] [2.0] Fill entire screen with a form control
Hi folks:
I have a form called VideoForm and i would like to fill the entire screen with the form (without any borders or taskbar). Is it that possible? If so... HOW?
Another question... can I send the content of that form to a secondary monitor?
Please help me with this stuff. I used to program with classic VB and doing a form full screen with VB was easy (BorderStyle = 0, MaximizeWindow) but i don't know how to do the same in C# (.NET).
Thank you in advance.
Best regards,
Andy
Re: [2.0] Fill entire screen with a form control
Would you be surprised to learn that it's virtually the same:
Code:
this.FormBorderStyle = FormBorderStyle.None;
this.WindowState = FormWindowState.Maximized;
As for the secondaty monitor, you can use the Screen class to get information about displays, so you can set the location of the form so that it is on the secondary display before maximising it.
Code:
foreach (Screen scr in Screen.AllScreens)
{
// Find the first non-primary screen.
if (!scr.Primary)
{
// Position the form on that screen.
this.Location = new Point(scr.Bounds.Left, scr.Bounds.Top);
break;
}
}
// Make the form full screen.
this.FormBorderStyle = FormBorderStyle.None;
this.WindowState = FormWindowState.Maximized;
Re: [2.0] Fill entire screen with a form control
Thank you so much. With two screens, the code works perfectly.
But if used with just one screen, when the form gets maximized, the task bar is still visible no matter what I do.
Is this a known issue? Is there any way to fix that?
Thank's again.
Andy
Re: [2.0] Fill entire screen with a form control
Sorry! I made a mistake. Everything works fine now.
Anyways, do you know how can I get the screens count before entering the foreach?
So the program decide whether to put the video form in the primary or secondary screen according to screens count? (if one... place in primary... if two... place in secondary...)
Re: [2.0] Fill entire screen with a form control
AllScreens is an array so you can just check its Length property.
Re: [2.0] Fill entire screen with a form control
Thank you. You are the best ;)