I have a tab control and to put a close button in the tab title I used:
private void systemRecordTabControl_DrawItem_1(object sender, DrawItemEventArgs e)
{
e.Graphics.DrawImage(Properties.Resources.icon, e.Bounds.Right - 15, e.Bounds.Top + 3, 11, 11);
e.Graphics.DrawString(systemRecordTabControl.TabPages[e.Index].Text, new Font("Arial", 12, FontStyle.Underline), Brushes.Black, e.Bounds.Left + 12, e.Bounds.Top + 4);
e.DrawFocusRectangle();
}
When the program is running, each time I switch between the tabs, the title text gets drawn again on top of the current tab text which causes it to be quite an eye sore
examples:
vs.
Is there anyway I can stop this from happening? I don't know how to check if its drawn already
Edit: As a side note this only happens when I set the tab page appearance to be "Buttons" while the DrawMode property is "OwnerDrawFixed", also changing the focus to another control causes the currently selected tab page to return to normal(no text overlapping)