Sign in to follow this  
Af0rest0fAsh

XNA in WinForms - Flickering

Recommended Posts

I have written a WinForms application in c#, and taken some tips from a tutorial I found called WinFormsGraphicsDevice, (can be found here ). The purpose of this application is to be an editor for a game I'm working on as part of a team this semester. It will allow rapid and simple creation of all visual game resources including levels, actors (humans and zombies), animations, items, weapons, etc... I wrote a custom control for drawing the visible portion of the level currently being edited, and it seems to work just fine. The only problem is that regardless of the rate at which the control is redrawn, a portion of the control's surface is briefly white. And at sixty frames per second this effect is very noticeable and distracting. I don't know enough about programming with the Windows API to say why this might be happening. Any help would be appreciated.

Share this post


Link to post
Share on other sites
Is the control still trying to clear its background?

Try calling this in the ctor:

Setstyle(Controlstyles.AllPaintingInWmPaint);


And override the OnPaintBackground method with an empty body:

protected override void OnPaintBackground(PaintEventArgs args)
{
}

Share this post


Link to post
Share on other sites
Thanks a lot for the suggestions. I'll try the easiest one first. :P

Edit: Thanks a bunch my friends. I prevented the my custom control's background from drawing as per your suggestion, and it eliminated the flickering.

[Edited by - Af0rest0fAsh on March 18, 2010 12:49:28 PM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this