none
DatGridView Column DragDrop RRS feed

  • Question

  • Hi all

    Using a WinForm with a datagridview I use DragDrop to exchange column posistions of two columns

    Everything is OK

    Now I wish to change the cursor  when the user use MouseDown on ColumnHeaderCell to exchange columns.

    I don't know how to use GiveFeedback in this case. What is the object to get feedback ?

    I tried with this code :

     Private Sub DGV_GiveFeedback(sender As Object, e As GiveFeedbackEventArgs) Handles DGV.GiveFeedback
    
            If ((e.Effect And DragDropEffects.Move) = DragDropEffects.Move) Then
                Cursor.Current = Cursors.Hand
                Else
                Cursor.Current = Cursors.Default
            End If
    
        End Sub

    (for now I use Cursor.Hand)

    Thank for help

    Tuesday, November 6, 2018 6:30 PM

Answers

  • Hi,

    just fix the code

        Private Sub DGV_GiveFeedback(sender As Object, e As GiveFeedbackEventArgs) Handles DGV.GiveFeedback
            e.UseDefaultCursors = False
        End Sub

    Best Regards,

    Alex


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Claudio111 Wednesday, November 7, 2018 7:52 AM
    Wednesday, November 7, 2018 2:43 AM

All replies

  • That is because

       Cursor.current =

    only lasts for the event then changes.

       Cursor = Cursors.Hand

    will change the shape permanently for the whole app.

    Tuesday, November 6, 2018 9:24 PM
  • Hi,

    just fix the code

        Private Sub DGV_GiveFeedback(sender As Object, e As GiveFeedbackEventArgs) Handles DGV.GiveFeedback
            e.UseDefaultCursors = False
        End Sub

    Best Regards,

    Alex


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Claudio111 Wednesday, November 7, 2018 7:52 AM
    Wednesday, November 7, 2018 2:43 AM