1

I have a vb.net windows forms project with a tabcontrol.

Anyone know how to change the style of the tabpage title or "button" when you hover over it with the pointer ?

I guess you can change the colours with:

TabControl1.SelectedTab.BackColor = Color.Black

But not sure how to hook up the mouseover to the hovered over tab title/button.

PeteTheGreek
  • 729
  • 2
  • 21
  • 41

2 Answers2

1

If you want to change color of the tab page (i.e. area with tab content), it is very easy to do as shown below.

However, if you want to change tab button, then you need to set TabControl1 DrawMode to TabDrawMode.OwnerDrawFixed and then handle DrawItem event.

Public Class Form1


      Private Sub TabControl1_MouseEnter(sender As System.Object, e As System.EventArgs) Handles TabControl1.MouseEnter
        TabControl1.SelectedTab.BackColor = Color.Black
      End Sub

      Private Sub TabControl1_MouseLeave(sender As System.Object, e As System.EventArgs) Handles TabControl1.MouseLeave
        TabControl1.SelectedTab.BackColor = DefaultBackColor
      End Sub
    End Class
alex
  • 74,215
  • 9
  • 49
  • 57
  • Based on alex's suggestion, check out: [Set TabPage Header Color](http://stackoverflow.com/questions/5338587/set-tabpage-header-color) – jdavies Sep 22 '11 at 15:52
1

The TabControl has a basic form of this functionality built in. Try setting HotTrack = True. When you mouseover the tab, it will change text colour.

Pondidum
  • 11,457
  • 8
  • 50
  • 69