Results 1 to 3 of 3

Thread: [RESOLVED] Tab control - Change cursor while dragging

Threaded View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2016
    Location
    Slovenia
    Posts
    575

    Resolved [RESOLVED] Tab control - Change cursor while dragging

    Hi,

    I've implemented Drag & Drop in Tab control and I want cursor to be changed while dragging Tabs. I got that part too, but with one slight problem - normally you change cursor on GiveFeedback event when you allready started drag drop action. Unfortunally I also set start of drag/drop in Mousedown, so when I click to change Tab page my new dragging cursor also appears for a moment, because left mouse click was done. Is there any way that I could start drag/drop with left mouse after I changed Tab page, and then change cursor ?

    My code:

    Code:
      Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
            MyBase.OnMouseDown(e)
    
         'Current tab is checked in MouseMove, and It's added into Tag
                If Not Me.Tag Is Nothing Then
    
                    Dim clickedTab As TabPage = DirectCast(Me.Tag, TabPage)
                    Dim clicked_index As Integer = Me.TabPages.IndexOf(clickedTab)
    
                    ' start drag n drop
                    Me.DoDragDrop(clickedTab, DragDropEffects.All)
    
                End If
    
        End Sub
    
    
        Protected Overrides Sub OnGiveFeedback(gfbevent As GiveFeedbackEventArgs)
            MyBase.OnGiveFeedback(gfbevent)
    
            ' Set the custom cursor based upon the effect.
            gfbevent.UseDefaultCursors = False
    
            If ((gfbevent.Effect And DragDropEffects.Move) = DragDropEffects.Move) Then
                Cursor.Current = Cursors.Hand
            Else
                Cursor.Current = Cursors.Default
                End If
    
        End Sub
    Last edited by LuckyLuke82; Jun 9th, 2017 at 07:13 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width