5

I got a problem with tabcontrol. When I change the DrawMode to ownderdrawfixed, the borderstyle of the tabcontrol changes from "fixedsingle" to "3dfixed" but there's no such a property of tabcontrol borderstyle. the closest thing to borderstyle of tabcontrol is the appearance which didnt change.

alt text

look at the picture above to understand what I am talking about.

is there any way to change to color of the tabpage title without ownerdraw so I will not have to use ownerdraw?

or how can I fix the borderstyle of the tabcontrol?

Deduplicator
  • 44,692
  • 7
  • 66
  • 118
Ron
  • 3,975
  • 17
  • 80
  • 130

1 Answers1

4

When you set a control to ownerdraw, you are specifically saying "I will handle all drawing for this control". This disables the visual styles rendering completely.

In order to render a control with visual styles, you'll need to use the facilities found in the System.Windows.Forms.VisualStyles namespace. It requires a good bit of code, but then you are saying you want to handle it all yourself. I'd start with the examples for VisualStyleRenderer - You'll need to call it, passing VisualStyleElements to render.

See also this question about treeview ownerdraw: VisualStyleRenderer and themes (WinForms)

Community
  • 1
  • 1
Philip Rieck
  • 32,368
  • 11
  • 87
  • 99
  • I got this function to draw the border I want http://msdn.microsoft.com/en-us/library/system.windows.forms.visualstyles.visualstyleelement.tab.pane%28v=VS.90%29.aspx but I dont know how to use it. when I put DrawVisualStyleElementTabPane1(e) in the form's paint function it draw a new "control". – Ron Dec 08 '10 at 19:49