well..

  • Thread starter Thread starter Nightmare
  • Start date Start date
N

Nightmare

Guest
I did this and I still get a flicker:
Visual Basic:
setstyle(ControlStyles.UserPaint, True)
setstyle(ControlStyles.AllPaintingInWmPaint, True)
setstyle(ControlStyles.DoubleBuffer, True)

?

*oops...this should have been in reply to my last post..*
 
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.
 
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?
 
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.
 
Back
Top