Guest Nightmare Posted November 13, 2002 Posted November 13, 2002 Okay...consider these two pieces of code (mousepointing is a point structure given a value outside of the sub): Private Sub picPart_QueryContinueDrag(ByVal sender As _ Object, ByVal e As System.Windows.Forms.QueryContinueDragEventArgs) dim newlocation as point newlocation = Me.PointToClient(MousePosition) newlocation.X -= mousepointing.X newlocation.Y -= mousepointing.Y sender.location = newlocation end sub AND Private Sub picPart_QueryContinueDrag(ByVal sender As _ Object, ByVal e As System.Windows.Forms.QueryContinueDragEventArgs) dim newlocation as point newlocation = Me.PointToClient(MousePosition) newlocation.X -= mousepointing.X newlocation.Y -= mousepointing.Y CreateGraphics.Clear(Me.BackColor) Dim gr As Graphics gr = Me.CreateGraphics gr.DrawImage(sender.image, newlocation) end sub The point of either of these functions is so that I can drag an image around a form with it appearing under the cursor as it is being dragged. Using DrawImage, after I am done dragging I obviously would need to move the picturebox to that location. As I understand it DrawImage is .NET's equivalent to BitBlt without an API call. However, moving the control around the form with the mouse causes virtually no flicker whereas using DrawImage does (for me anyway). So which one is more efficient, less memory draining...and which one would you recommend using? Or is there a better method...I'm no expert on this stuff... Quote
*Gurus* divil Posted November 13, 2002 *Gurus* Posted November 13, 2002 If you look up Double Buffering on drawing graphics, you could avoid the flickering problem. 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.