WinForms TabControl: How to avoid tab-rendering on DrawMode=OwnerDrawFixed?

Posted by splattne on Stack Overflow See other posts from Stack Overflow or by splattne
Published on 2010-03-29T15:11:47Z Indexed on 2010/03/29 15:53 UTC
Read the original article Hit count: 883

Filed under:
|
|
|
|

I extended the (WindowsForms) built-in TabControl in order to implement closing tabs right on the tab itself ("x" image on the right like in Webbrowsers). The inherited control renders the text and images. Also, it uses visual styles on hover etc.

All works very well, but I have one problem I can't solve. When the tabs are rendered, I cannot avoid that the Control paints the tabs another time as seen in this screenshot:

TabControl screenshot

That's a problem for two reasons:

  1. It looks ugly on the selected tab
  2. I'd like to increase the tabs' width because the current width doesn't take account of the "x" image on the right

Any idea how to solve this?

© Stack Overflow or respective owner

Related posts about windowsforms

Related posts about tabcontrol