Guest Nightmare Posted November 13, 2002 Posted November 13, 2002 I did this and I still get a flicker: setstyle(ControlStyles.UserPaint, True) setstyle(ControlStyles.AllPaintingInWmPaint, True) setstyle(ControlStyles.DoubleBuffer, True) ? *oops...this should have been in reply to my last post..* Quote
*Gurus* divil Posted November 13, 2002 *Gurus* Posted November 13, 2002 As long as you are actually doing all your drawing in the Paint event (or in your override of OnPaint) that should double buffer nicely. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Guest Nightmare Posted November 14, 2002 Posted November 14, 2002 Well that's where I do my drawing... However, since I'm using QueryContinueDrag, and the Paint event never gets called when a control is being dragged, I had to invoke the paint event myself. In the paint event I do a CreateGraphics.Clear and then a CreateGraphics.DrawImage...and it seems like because I am constantly clearing, and then drawing the image, that there is a flicker...though I obviously must be doing something wrong. This is the only way I can think of to keep the image under the mouse as I'm dragging it without actually moving the PictureBox... The only solution that I can see to my problem is using an API and I don't want to do that. I know BitBlt would work though, as it did in VB 6 (and this program is one that I'm converting to VB.NET from a working VB 6 program for practice). Any ideas? Am I an idiot? Quote
*Gurus* divil Posted November 14, 2002 *Gurus* Posted November 14, 2002 You shouldn't be using CreateGraphics. That defeats the point of all the double-buffering and painting management that is there for you. You should be using the Graphics object passed to the Paint event through e.Graphics. Then it knows what to do with it. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.