)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to customize the appearance of the WinForms TabControlAdv while HotTracking?

Platform: WinForms |
Control: TabControlAdv |
Published Date: April 30, 2011 |
Last Revised Date: January 31, 2020

Customize the appearance of TabControlAdv while HotTracking

You can customize the appearance of the TabControlAdv while HotTracking. This can be achieved by handling the event, DrawItem in the TabControlAdv. The argument, DrawTabEventArgs gets the data for the Syncfusion.Windows.Forms.Tools.TabControlAdv.DrawItem event handler in the TabControlAdv. Within this event handler, check whether the TabItem is being HotTracked, and when it is, set the desired forecolor and backcolor to the DrawTabEventArgs object. The arguments contain all the necessary information that helps the user to paint the specified tab item. The following are the properties and functions.

Properties:

1. BackColor - Gets or sets the background color of the specified tab item.

2. ForeColor - Gets or sets the forecolor of the specified tab item text.

3. Font - Gets or sets the font of the specified tab item.

4. Bounds - Gets or sets the bounds of the specified tab item. They include the space for the border.

5. BoundsInterior - Gets or sets the bounds of the specified tab item without having space for the borders.

6. Graphics - Returns the graphics surface to draw the tab item.

7. Index - Returns the index value of the tab item.

8. DrawItemState - Gets or sets the item state.

9. TextBrush - Gets or sets the brush to draw the text.

 

Functions:

1. DrawBackground - Draws the background.

2. DrawBorders - Draws the borders within the bounds specified.

3. DrawInterior - Draws the text and image within the bounds specified.

C#

//Enables the HotTrack. It helps to change the appearance of the TabControlAdv on mouse hover.
this.tabControlAdv1.HotTrack = true;
//Draws the Tab item.
this.tabControlAdv1.DrawItem += new DrawTabEventHandler(tabControlAdv1_DrawItem);
void tabControlAdv1_DrawItem(object sender, DrawTabEventArgs drawItemInfo)
{
    //Checks whether the HotTracking is in progress.
    if ((drawItemInfo.State & DrawItemState.HotLight) > 0)
    {
        drawItemInfo.ForeColor = Color.Red;
        drawItemInfo.BackColor = Color.Khaki;
        drawItemInfo.Font = new Font("Segoe Marker", 12.0F, FontStyle.Italic);
    }
    //Draws the default background and interior.
    drawItemInfo.DrawBackground();
    drawItemInfo.DrawInterior();
}

VB

'Enables the HotTrack. It helps to change the appearance of the TabControlAdv on mouse hover.
Me.tabControlAdv1.HotTrack = True
'Draws the Tab item.
AddHandler tabControlAdv1.DrawItem, AddressOf tabControlAdv1_DrawItem
Private Sub tabControlAdv1_DrawItem(ByVal sender As Object, ByVal drawItemInfo As DrawTabEventArgs)
   'Checks whether the HotTracking is in progress.
   If (drawItemInfo.State And DrawItemState.HotLight) > 0 Then
     drawItemInfo.ForeColor = Color.Red
     drawItemInfo.BackColor = Color.Khaki
     drawItemInfo.Font = New Font("Segoe Marker", 12.0F, FontStyle.Italic)
   End If
   'Draws the default background and interior.
   drawItemInfo.DrawBackground()
   drawItemInfo.DrawInterior()
End Sub

 

Note:

The property named “HotTrack” in TabControlAdv changes the appearance of the TabPageAdv when the mouse passes over them.

 


Before enabling the HotTrack property

Figure 1: Before enabling the HotTrack property

After enabling the HotTrack property

Figure 2: After enabling the HotTrack property

Before customize the appearance of TabPageAdv when HotTrack is enabled

Figure 3: Before customizing the appearance of the TabPageAdv when HotTrack property is enabled

Before customize the back and forecolor of TabPageAdv when HotTrack is enabled

Figure 4: After customizing the forecolor and backcolor of the TabPageAdv when HotTrack property is enabled

After customize the appearance, back and forecolor of TabPageAdv when HotTrack is enabled

Figure 5: After customizing the appearance, HotTrack enabled and Forecolor, BackColor and Font specified

Samples:

C#: TabControlAdv_HotTrack_C#

VB: TabControlAdv_HotTrack_VB

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon