public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.tabControlAdv1.FocusOnTabClick = false;
this.tabControlAdv1.Alignment = TabAlignment.Left;
this.tabControlAdv1.RotateTextWhenVertical = true;
SkinManager.SetVisualStyle(this, "Office2019Colorful");
this.tabControlAdv1.ThemeStyle.TabStyle.ActiveBackColor = Color.White;
this.tabControlAdv1.ThemeStyle.TabStyle.InactiveBackColor = Color.White;
this.tabControlAdv1.ThemeStyle.TabStyle.ActiveForeColor = ColorTranslator.FromHtml("#2277c5");
this.tabControlAdv1.ThemeStyle.TabPanelBackColor = Color.White;
this.tabControlAdv1.DrawItem += TabControlAdv1_DrawItem;
this.tabControlAdv1.ImageAlignmentR = RelativeImageAlignment.AboveText;
}
private void TabControlAdv1_DrawItem(object sender, Syncfusion.Windows.Forms.Tools.DrawTabEventArgs drawItemInfo)
{
Graphics g = drawItemInfo.Graphics;
//Draws the default background and interior.
//Let's us to draw tab pages using Custom renderer.
drawItemInfo.DrawBackground();
drawItemInfo.DrawInterior();
if ((drawItemInfo.Index == tabControlAdv1.SelectedIndex) & ((int)DrawItemState.Selected) > 0)
{
//Gets the bounds of the selected tab page.
RectangleF tabBounds = this.tabControlAdv1.GetTabRect(this.tabControlAdv1.SelectedIndex);
//Draws the line on top of selected tab page
g.DrawLine(new Pen(ColorTranslator.FromHtml("#2277c5"), 2), new PointF(tabBounds.Left + tabBounds.Width -1, tabBounds.Bottom ),
new PointF(tabBounds.Left + tabBounds.Width-1, tabBounds.Top ));
}
g.ResetTransform();
}
} |