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...
[.net] How do i make a fullscreen window??
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
The taskbar is now invisible.
I'm still trying to fix the refreshing... I'll post on my results
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.
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! :)
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?
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?
If all you need is to paint a still image, I think that you should be able to do it overriding OnPaintBackground...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement