public static void DrawTabItem (Graphics g, Rectangle bounds, string tabItemText, Font font, TextFormatFlags flags, Image image, Rectangle imageRectangle, bool focused, TabItemState state) { if (!IsSupported) throw new InvalidOperationException (); VisualStyleRenderer vsr; switch (state) { case TabItemState.Disabled: vsr = new VisualStyleRenderer (VisualStyleElement.Tab.TabItem.Disabled); break; case TabItemState.Hot: vsr = new VisualStyleRenderer (VisualStyleElement.Tab.TabItem.Hot); break; case TabItemState.Normal: default: vsr = new VisualStyleRenderer (VisualStyleElement.Tab.TabItem.Normal); break; case TabItemState.Selected: vsr = new VisualStyleRenderer (VisualStyleElement.Tab.TabItem.Pressed); break; } vsr.DrawBackground (g, bounds); if(image != null) vsr.DrawImage(g, imageRectangle, image); bounds.Offset(3,3); bounds.Height -= 6; bounds.Width -= 6; if(tabItemText != String.Empty) TextRenderer.DrawText(g, tabItemText, font, bounds, SystemColors.ControlText,flags); if(focused) ControlPaint.DrawFocusRectangle(g, bounds); }