Answered get mouse pos in tab header

  • Thursday, August 02, 2012 4:54 PM
     
     

    Hi,

    I have drawed the tab pages so, that they overlap the other (I extended the tabs with 25 points).

    Now if I click on the extended area on the first tab header, the second gets the focus.

    How can I figure out, that in this case, the first tab gets the focus?

    Thanks.

All Replies

  • Friday, August 03, 2012 12:48 AM
     
     

    Is this thread helpful? http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/021a59bf-3950-4504-a0eb-3bde08faa22a

    Or maybe this link concerning overdrawn tab controls? http://dotnetrix.co.uk/tabcontrol.htm


    You've taught me everything I know but not everything you know.


  • Friday, August 03, 2012 8:18 AM
     
     

    hi,

    I know both of the links.

    it woult be great, if I could locate the relative mouse pos to the current tab header. And then I could check, if the mousepos.x<..., then the tab bevor the selected is really selected.

  • Sunday, August 05, 2012 2:48 AM
     
     Answered Has Code

    This code will give you mouse location but I don't know if it will help you in your goals.....It is global though and not specific to a form.

    Public Class Form1
    
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    
        End Sub
    
        Dim WithEvents Tmr As New Timer
        Dim Lbl As New Label
        Protected Overrides Sub OnLoad(e As System.EventArgs)
            MyBase.OnLoad(e)
            Me.Lbl.Parent = Me
            Me.Tmr.Start()
        End Sub
        Private Sub Tmr_Tick(sender As Object, e As EventArgs) Handles Tmr.Tick
            Lbl.Left = 65
            Lbl.Top = 100
            Lbl.Height = 60
            Lbl.Width = 200
            Lbl.Font = New Font("Arial", 14, FontStyle.Bold)
            Lbl.Anchor = AnchorStyles.Left & AnchorStyles.Right & AnchorStyles.Bottom & AnchorStyles.Top
            Lbl.Text = Cursor.Position.ToString
            'If Lbl.Text = "{X=0,Y=0}" Then
            'MessageBox.Show("Do Something")
            'End If
        End Sub
    
    End Class


    You've taught me everything I know but not everything you know.

    • Marked As Answer by DerStauner Tuesday, August 07, 2012 8:15 PM
    •  
  • Tuesday, August 07, 2012 8:15 PM
     
     

    This question is no more interesting for me. I let the tab control so.