Jump to content
  • Advertisement
Sign in to follow this  
Af0rest0fAsh

XNA in WinForms - Flickering

This topic is 3043 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!