I am struggling to find a way to color the tab headers of a tabpage in WinForms. There are solutions to color the current indexed tab using the OnDrawItem
event, but is it possible to color all the tabs with different colors to make them more intuitive for users for certain behavior?
Thanks in advance.
Best Answer
An improved version of Ash's answer:
This code uses the
TextRenderer
class to draw its text (as .NET does), fixes problems with font clipping/wrapping by not negatively inflating the bounds, and takes tab selection into account.Thanks to Ash for the original code.