enablerbr's picture

Fullscreen question.

i found out that windows forms don't support fullscreen or at least true fullscreen. so that means i can't use GLControl for fullscreen. so i just wanted to check that Gamewindow allows true fullscreen.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

What do you mean by "true" fullscreen? Both WinForms/GLControl and GameWindow support fullscreen modes.

enablerbr's picture

in the case of windows forms. i had to do this.

     this.Bounds = Screen.PrimaryScreen.Bounds;
            this.FormBorderStyle = FormBorderStyle.None;
            this.StartPosition = FormStartPosition.CenterScreen;

which gives a small rectangle edge around the fullscreen. which shows the desktop through. also the taskbar is still displayed.

the Fiddler's picture

The correct way to go fullscreen is this:

this.TopMost = true;
this.FormBorderStyle = FormBorderStyle.None;
this.WindowState = FormWindowState.Maximized;

Edit: This is for Windows.Forms. For the GameWindow see below.

Edit 2: Added the TopMost property to make the WM happy (and potentially improve performance).

objarni's picture

something.Fullscreen() ?

the Fiddler's picture

Why? :) This is the documented way of going fullscreen on Windows.Forms, whereas something like Form.Fullscreen() would be unknown to the wide world.

GameWindow is slightly simpler:

this.WindowState = WindowState.Fullscreen;
enablerbr's picture

ahh. thanks.

objarni's picture

Well, the reason being support questions like this one. Having to set three properties, potentially in some order (?) is bound to generate support traffic.

Fullscreen() or Fullscreen = true property could be added to GLControl, for instance.

the Fiddler's picture

Nah, I don't mind, more support traffic means more money from advertisements. (Wait, wut?)

Ok, back on topic, "GLControl.Fullscreen = true" doesn't really make sense. Why would you try to set a child control fullscreen, instead of the parent Form? This wouldn't even work on Windows, unless you change the child window to a top-level one (and you don't want to go there). No idea about other platforms.

Or do you mean we should detach the GLControl behind the scenes, attach it to a new Form and make the new Form fullscreen? It should be obvious why this can never work reliably (event handlers, private data, code that expects GLControl to exist in the original Form, etc etc).

The only thing that could conceivably work, is to search for the original parent form and set that to fullscreen. Which is counter-intuitive: "I asked for the GLControl to go fullscreen, not the whole window! I don't want my other controls visible."

Which brings us full circle to the original implementation: there is a documented way to make a Form fullscreen, so use it. :)

objarni's picture

Agreed. Actually, it is somewhat vague what "fullscreen" means for a WinForm.

Where is the documented way to make a form Fullscreen?

the Fiddler's picture

Interesting, I first read this on msdn, but I can's seem to find the link now. Searching for ".net fullscreen form" yields the above code, unfortunately through a lot of noise.

I'll add this to the FAQ.