Spiro Posted February 21, 2003 Posted February 21, 2003 Hi, I have problem with DragDrop. I trying to move reactangle along with te cursor. Private Graphic as Graphics= Panel1.CreateGraphics Private Sub Panel1_DragOver(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles frm.DragOver Dim NewP = New Point(e.x,e.y) Dim rec As New Drawing.Rectangle(NewP, SelCtl.Size) Graphic.Clear(frm.BackColor) Graphic.DrawRectangle(Penk, rec) end sub How can i simulate Flip method from DDraw to avoid flickering? Quote
*Gurus* divil Posted February 21, 2003 *Gurus* Posted February 21, 2003 You'll have to take advantage of the build-in double buffering, which on the face of it is quite easy but you'll have to do a bit of work in this instance to get it working. Firstly, you'll have to inherit from Panel and use your own control instead, because you need to use the protected function SetStyle to enable Double Buffering and other associated styles. Then you'll have to give that control some kind of property for setting where the rectangle should be drawn. Finally, in the DragOver event, instead of drawing you set the rectangle property and call .Invalidate on the control, forcing it to draw itself. Double buffering in Windows Forms only works when the control draws itself in the Paint event. 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.