I am wishing to drag something from the desktop to a tab of a tab control in
vb.net.
The dragdrop event fires when release the mouse above the tab however i am
having a hard time trying to figure out which tab it was dropped on.
Currently i am using the following code but it is not working..Any help
would be appreciated...
Private Sub tc_DragDrop(ByV al sender As Object, ByVal e As
System.Windows. Forms.DragEvent Args) Handles tc.DragDrop
Dim pt As New Point(e.X, e.Y)
pt = PointToClient(p t)
Dim hover_tab As TabPage = GetTabPageByTab (e.X, e.Y)
If Not hover_tab Is Nothing Then
Debug.Write("go t it")
End If
End Sub
Private Function GetTabPageByTab (ByVal x As Integer, ByVal y As Integer)
As TabPage
'Private Function GetTabPageByTab (ByVal pt As Point) As TabPage
Dim tp As TabPage = Nothing
Dim i As Integer = 0
For i = 0 To tc.TabPages.Cou nt - 1
Dim tabRec As System.Drawing. Rectangle = tc.GetTabRect(i )
Debug.WriteLine (DateTime.Now.T oString & " " & i.ToString &
tabRec.X & " " & tabRec.Y & " Point X " & x & " " & y & "____")
If tc.GetTabRect(i ).Contains(x, y) Then
tp = tc.TabPages(i)
tc.SelectedInde x = i
Debug.WriteLine (DateTime.Now.T oString & " " & i.ToString)
Exit For
End If
Next
Return tp
End Function