Gerald Tan
Gerald Tan

Reputation: 91

Show dragged item while dragging vb.net

I'm wanting to show the dragged control while dragging in my form. I have a list of controls (textboxes and a picturebox) which are draggable. I would like to show the dragged control all the time, as long as the control is being dragged, even if the user cannot drop it. I also have an issue with dragging the picture box. It shows a dragged image of the control, however it flickers.

Code for drag feedback for picture box

Private Sub qrCode_GiveFeedback(ByVal sender As Object, ByVal e As GiveFeedbackEventArgs) Handles QRCodeDrag.GiveFeedback
    Dim bitmap As Bitmap
    bitmap = New Bitmap(QRCodeDrag.Width, QRCodeDrag.Height)
    QRCodeDrag.DrawToBitmap(bitmap, New Rectangle(Point.Empty, bitmap.Size))
    'bitmap.MakeTransparent(Color.White)

    Dim cursor As New Cursor(bitmap.GetHicon)
    Cursor.Current = cursor
End Sub

Any ideas?

Upvotes: 0

Views: 393

Answers (1)

Gerald Tan
Gerald Tan

Reputation: 91

I forgot to add

e.UseDefaultCursors = False

This solved the issue of the flicker

Upvotes: 1

Related Questions