VBForums >
.NET >
C# > [RESOLVED] [2.0] Fill entire screen with a form control
Click to See Complete Forum and Search --> : [RESOLVED] [2.0] Fill entire screen with a form control
UnknownX
Mar 28th, 2006, 10:41 PM
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
jmcilhinney
Mar 28th, 2006, 10:56 PM
Would you be surprised to learn that it's virtually the same: 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. 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;
UnknownX
Mar 29th, 2006, 12:20 AM
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
UnknownX
Mar 29th, 2006, 12:32 AM
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...)
jmcilhinney
Mar 29th, 2006, 12:39 AM
AllScreens is an array so you can just check its Length property.
UnknownX
Mar 29th, 2006, 07:54 AM
Thank you. You are the best ;)
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.