Category / Section
How to prevent the focus rect from being drawn in the tabs of WinForms TabControlAdv?
1 min read
Prevent focus from being drawn in the tabs
You can easily do this by handling the DrawItem event, adjusting the DrawTabEventArgs as follows, and delegating drawing to the default drawing logic.
C#
private void TabControlExt_DrawItem(object sender, Syncfusion.Windows.Forms.Tools.DrawTabEventArgs drawItemInfo) { // To indicate that the tab gets drawn as if it’s not focused (without the focus rect). drawItemInfo.State &= ~DrawItemState.Focus; // Then forward drawing to default drawing logic. drawItemInfo.DrawBackground(); drawItemInfo.DrawInterior(); drawItemInfo.DrawBorders(); }
VB
Private Sub TabControlExt_DrawItem(ByVal sender As Object, ByVal drawItemInfo As Syncfusion.Windows.Forms.Tools.DrawTabEventArgs) ' To indicate that the tab gets drawn as if it’s not focused (without the focus rect). Dim & As drawItemInfo.State = ~DrawItemState.Focus ' Then forward drawing to default drawing logic. drawItemInfo.DrawBackground() drawItemInfo.DrawInterior() drawItemInfo.DrawBorders() End Sub