Jump to content
  • Advertisement
Sign in to follow this  
Quat

[.net] custom control flicker--using Direct3D

This topic is 3925 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 a custom control written in C++/CLI, and I'm using Direct3D for rendering an object in the control. The user can click on the control and move the mouse to rotate the object. This is working, but I am getting a very bad flickering. I tried setting various styles in the control constructor: this->Setstyle(static_cast<Controlstyles>( /*Controlstyles::OptimizedDoubleBuffer | */ /*Controlstyles::UserPaint |*/ Controlstyles::AllPaintingInWmPaint | Controlstyles::ResizeRedraw | Controlstyles::Selectable), true ); this->Updatestyles(); If I uncomment the double buffering styles and user paint, I don't get any output--like my paint handler doesn't get called at all. Even with AllPaintingInWmPaint I still get flicker. In my mouse move handler, if the left mouse button is down, I call Invalidate to redraw. I do my drawing in OnPaint: void D3DControl::OnPaint(PaintEventArgs^ e) { if( device) { device->Clear(0, 0, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, 0x00000000, 1.0f, 0); device->BeginScene(); ... Anyone know what I'm doing wrong?

Share this post


Link to post
Share on other sites
Advertisement
I got it to work by overriding OnPaintBackground and doing nothing. So for some reason it looks like

Controlstyles::AllPaintingInWmPaint

wasn't working.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!