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

Started by
17 comments, last by NexusOne 18 years ago
Another note...

When you set these control styles:

this.Setstyle(Controlstyles.DoubleBuffer | Controlstyles.UserPaint |
Controlstyles.AllPaintingInWmPaint | Controlstyles.FixedWidth |
Controlstyles.FixedHeight, true);

I suppose that you are calling Invalidate() somewhere to force the OnPaint function (or the Paint event) being called...
Advertisement
Wow, removing "WindowState = FormWindowState.Maximized" worked!
The taskbar is now invisible.
I'm still trying to fix the refreshing... I'll post on my results
Graphics make the game! 8-)
I'm calling Invalidate() at the bottom of OnPaint() itself, as well as initially in the Form's constructor. I'm not sure why but in the fullscreen window it still doesn't refresh.
Graphics make the game! 8-)
Quote:Controlstyles.UserPaint
If true, the control paints itself rather than the operating system doing so. If false, the Paint event is not raised. This style only applies to classes derived from Control.


So my guess is that the OnPaint event override is not being called. You can put a breakpoint in the OnPaint method to verify if this guess is correct. If you need this flag for double buffering, this comment in the docs might be of help:

Quote:the preferred method for enabling double buffering, which yields the same result, is to set the DoubleBuffered property for the control to true.


Good luck! :)
Rim van Wersch [ MDXInfo ] [ XNAInfo ] [ YouTube ] - Do yourself a favor and bookmark this excellent free online D3D/shader book!
Actually, I checked and OnPaint() IS being called. OnPaint() doesn't really do anything, though, since nothing in the window actually needs updating. In my window is a large image. Instead of drawing the image, the whole image just appears white, until the window is physically moved (then the image shows up properly).

My code has always worked fine before, i.e. in all my existing non-fullscreen windows any images will be rendered properly from the moment the window appears. So why would making the window fullscreen change this? The only real change is that TopMost is true, but why would this affect whether an image renders?
Graphics make the game! 8-)
I take it no-one has any idea why a TopMost window won't update its image?
Graphics make the game! 8-)
Could you please post your OnPaint code, so I may help you better?


Augusto.
If all you need is to paint a still image, I think that you should be able to do it overriding OnPaintBackground...
protected override void OnPaint(System.Windows.Forms.PaintEventArgs args){
pictureBox.updateImage(); //updates the bitmap of the picturebox
this.Invalidate();
}

It's not a still image; the image may be changed at any time

[Edited by - NexusOne on April 6, 2006 1:40:08 AM]
Graphics make the game! 8-)

This topic is closed to new replies.

Advertisement