[.net] How do i make a fullscreen window??

Started by
17 comments, last by NexusOne 18 years ago
I'm having a world of trouble getting my Form to be fullscreen. I mean FULLSCREEN, not just maximized. I said WindowState = FormWindowState.Maximized and FormBorderstyle = FormBorderstyle.None but nothing seems to be able to hide the taskbar, which is always on top of my window no matter what; how can I get rid of it??
Graphics make the game! 8-)
Advertisement
You might have to PInvoke the Win32 functions that do this for you, or DirectX might well provide a method for it, if you're using that.
No I'm not using DirectX or any other graphics APIs. I'm sure somewhere in .Net there must be a way to make a window fullscreen!
Graphics make the game! 8-)
Does the order in which you set those two properties matter?

I would imagine that setting the Borderstyle first then maximising should get it to work..

Otherwise, just set those during design time... That's always worked for me.
Delphi C++ OpenGL Development: www.nitrogen.za.org
You could also try setting the form's Form.TopMost property to true.

[Website] [+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++]

I think the problem is because Maximized will set the window to the size of the screen, minus any toolbars. You need to get a way to draw over the toolbars, or a way to get rid of them.
You can create a "fake" fullscreen window getting information of the screen size, and positioning it manually.

In VB would be something like this:

Dim scrSize as Rectangle = Screen.PrimaryScreen.Bounds

Me.FormBorderstyle = FormBorderstyle.None
Me.TopMost = True
Me.StartPosition = FormStartPosition.Manual
Me.ClientSize = New Size(scrSize.Width, scrSize.Height)
Me.Location = New Point(0, 0)

Hope it helps...
OK, I added TopMost = true, but it didn't help.

I also checked and the height I got from Screen.PrimaryScreen.Bounds really is the correct height of the screen, it doesn't leave out the toolbars (it's 768, which is correct for my screen).

all of this code seems to make it fullscreen-except-for-the-taskbar, and it also somehow breaks the refreshing of the window:

//"width" and "height" are correct
this.Size = new System.Drawing.Size(width, height);
this.Setstyle(Controlstyles.DoubleBuffer | Controlstyles.UserPaint |
Controlstyles.AllPaintingInWmPaint | Controlstyles.FixedWidth |
Controlstyles.FixedHeight, true);
this.Updatestyles();
this.FormBorderstyle = FormBorderstyle.None;
this.TopMost = true;
this.StartPosition = FormStartPosition.CenterScreen;
this.WindowState = FormWindowState.Maximized;
this.ClientSize = new System.Drawing.Size(width, height);
this.Location = this.DesktopLocation = new System.Drawing.Point(0, 0);

so apparently something is still missing- the window, which refreshes properly when not fullscreen, stops refreshing when it's set to be fullscreen. But the main problem is that the taskbar is still visible, even with all this code.
Graphics make the game! 8-)
Ok, its Win32 but I think this is the best shot unless someone knows for sure:
http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=01

Ignore the OpenGL stuff and just focus on the Win32 calls. If I remember right, if you remove all the calls to OpenGL you still get a fullscreen window, meaning its done by Win32 (you can likely do it too then).

Sorry just seemed few others had answers. Can I ask why you want to do this? It would hide the menu also I do believe.

"Those who would give up essential liberty to purchase a little temporary safety deserve neither liberty nor safety." --Benjamin Franklin

You shouldn't user WindowState = FormWindowState.Maximized.

Just leave a normal window. If you set the window to a maximized state, it doesn´t matter which size you set to the window, because the window will be _MAXIMIZED_, that is, using all the WorkingArea, which is the client part of the desktop (full size except docked windows sush as the taskbar)

Give a try to the code I posted earlier - it works!

Just a note: If you have a look at installshield installers, it uses "fullscreen windows" (with borders). If you maximize the window using the maximize button, the taskbar appears. XD

Hope this helps,


Augusto.

This topic is closed to new replies.

Advertisement