VB.net 2005 Tabcontrol

S

Steve

Hi All

Is there any way to change the colour of the Tabcontrol Tab header strip

I have found how to override the individual Tab header colours in the
drawitem event but the rest of the Tabcontrol's Tab header is the default
windows control colour

If the Tab headers don't fill the Tabcontrol header strip it looks tacky

Failing this can anybody recommend a 3rd party Tabcontrol with can be
customised better

Regards
Steve
 
L

Linda Liu[MSFT]

Hi Steve,

I searched the Internet and found a sample of a TabControl with owner-drawn
tabs. You may visit the following link for more information:

http://www.vb-helper.com/howto_net_ownerdraw_tab.html

Hope this helps.
If you have any question, please feel free to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
S

Steve

Hi Linda

Thats not what I need

I need to change the colour of the Tabcontrol Tab bar, i.e the header where
all the Tabpage headers sit, not the Tabpages themselves

If you get a Tabcontrol and put 2 or 3 tabpages on it, the space after the
last Tabpage header is a default colour which I need to change

Regards
Steve
 
L

Linda Liu[MSFT]

Hi Steve,

Thank you for your prompt reply!

To get what you want, you need to get the rectangle representing the
TabControl's header strip first and then create a GraphicsPath object. Add
the header strip rectangle and all the tab rectangles to the GraphicsPath
object. Then fill the GraphicsPath object with the color you want. By
default, the FillMode property of a GraphicsPath is Alternate, which means
the overlap is subtractive.

The following is a sample:
Private Sub TabControl1_DrawItem(ByVal sender As Object, ByVal e As
System.Windows.Forms.DrawItemEventArgs) Handles TabControl1.DrawItem
' rectange representing the TabControl's header strip
Dim header_rect As New Rectangle(TabControl1.ClientRectangle.X,
tab_rect.Y, TabControl1.ClientRectangle.Width, tab_rect.Height)

Dim path As New GraphicsPath()
path.AddRectangle(header_rect)
For i As Integer = 0 To TabControl1.TabCount - 1
path.AddRectangle(TabControl1.GetTabRect(i))
Next

e.Graphics.FillPath(Brushes.Yellow, path)
End Sub

Hope this helps.
If you have any question, please feel free to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top