N
Nightmare
Guest
Okay...consider these two pieces of code (mousepointing is a point structure given a value outside of the sub):
AND
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 .NETs 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...Im no expert on this stuff...
Code:
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
Code:
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 .NETs 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...Im no expert on this stuff...