Color theme of toolstrip and menustrip

T

Teemu

I'm wondering if there is a easy way to change for example toolstrips
appearance. I'd like to have the same theme as in VB2005. Brown backgroung
instead of the light blue. Can this be done without creating own custom draw
procedure?

Somehow the theme of Visual Studio looks more professional than the original
blue color.

-Teemu
 
K

Ken Tucker [MVP]

Hi,

You can change the color scheme by creating a new ProfessionColorTable.
Then tell the toolstrip renderer to use the new color table. I created a
color table based on the c# code found here.

http://blogs.msdn.com/jfoscoding/articles/489637.aspx

To changing the color scheme of the renderer

ToolStrip1.Renderer = New ToolStripProfessionalRenderer(New TanColorScheme)

Here is the code for the professionalcolortable

Public Class TanColorScheme
Inherits ProfessionalColorTable

Public Overrides ReadOnly Property ButtonCheckedGradientBegin() As
System.Drawing.Color
Get
Return Color.FromArgb(&HC1, 210, &HEE)
End Get
End Property

Public Overrides ReadOnly Property ButtonCheckedGradientEnd() As
System.Drawing.Color
Get
Return Color.FromArgb(&HC1, 210, &HEE)
End Get
End Property

Public Overrides ReadOnly Property ButtonCheckedGradientMiddle() As
System.Drawing.Color
Get
Return Color.FromArgb(&HC1, 210, &HEE)
End Get
End Property

Public Overrides ReadOnly Property ButtonPressedBorder() As
System.Drawing.Color
Get
Return Color.FromArgb(&H31, &H6A, &HC5)
End Get
End Property

Public Overrides ReadOnly Property ButtonPressedGradientBegin() As
System.Drawing.Color
Get
Return Color.FromArgb(&H98, &HB5, &HE2)
End Get
End Property

Public Overrides ReadOnly Property ButtonPressedGradientEnd() As
System.Drawing.Color
Get
Return Color.FromArgb(&H98, &HB5, &HE2)
End Get
End Property

Public Overrides ReadOnly Property ButtonPressedGradientMiddle() As
System.Drawing.Color
Get
Return Color.FromArgb(&H98, &HB5, &HE2)
End Get
End Property

Public Overrides ReadOnly Property ButtonSelectedBorder() As
System.Drawing.Color
Get
Return MyBase.ButtonSelectedBorder
End Get
End Property

Public Overrides ReadOnly Property ButtonSelectedGradientBegin() As
System.Drawing.Color
Get
Return Color.FromArgb(&HC1, 210, &HEE)
End Get
End Property

Public Overrides ReadOnly Property ButtonSelectedGradientEnd() As
System.Drawing.Color
Get
Return Color.FromArgb(&HC1, 210, &HEE)
End Get
End Property

Public Overrides ReadOnly Property ButtonSelectedGradientMiddle() As
System.Drawing.Color
Get
Return Color.FromArgb(&HC1, 210, &HEE)
End Get
End Property

Public Overrides ReadOnly Property CheckBackground() As
System.Drawing.Color
Get
Return Color.FromArgb(&HE1, 230, &HE8)
End Get
End Property

Public Overrides ReadOnly Property CheckPressedBackground() As
System.Drawing.Color
Get
Return Color.FromArgb(&H31, &H6A, &HC5)
End Get
End Property

Public Overrides ReadOnly Property CheckSelectedBackground() As
System.Drawing.Color
Get
Return Color.FromArgb(&H31, &H6A, &HC5)
End Get
End Property

Public Overrides ReadOnly Property GripDark() As System.Drawing.Color
Get
Return Color.FromArgb(&HC1, 190, &HB3)
End Get
End Property

Public Overrides ReadOnly Property GripLight() As System.Drawing.Color
Get
Return Color.FromArgb(&HFF, &HFF, &HFF)
End Get
End Property

Public Overrides ReadOnly Property ImageMarginGradientBegin() As
System.Drawing.Color
Get
Return Color.FromArgb(&HFE, &HFE, &HFB)
End Get
End Property

Public Overrides ReadOnly Property ImageMarginGradientEnd() As
System.Drawing.Color
Get
Return Color.FromArgb(&HBD, &HBD, &HA3)
End Get
End Property

Public Overrides ReadOnly Property ImageMarginGradientMiddle() As
System.Drawing.Color
Get
Return Color.FromArgb(&HEC, &HE7, &HE0)
End Get
End Property

Public Overrides ReadOnly Property ImageMarginRevealedGradientBegin() As
System.Drawing.Color
Get
Return Color.FromArgb(&HF7, &HF6, &HEF)
End Get
End Property

Public Overrides ReadOnly Property ImageMarginRevealedGradientEnd() As
System.Drawing.Color
Get
Return Color.FromArgb(230, &HE3, 210)
End Get
End Property

Public Overrides ReadOnly Property ImageMarginRevealedGradientMiddle()
As System.Drawing.Color
Get
Return Color.FromArgb(&HF2, 240, &HE4)
End Get
End Property

Public Overrides ReadOnly Property MenuBorder() As System.Drawing.Color
Get
Return Color.FromArgb(&H8A, &H86, &H7A)
End Get
End Property

Public Overrides ReadOnly Property MenuItemBorder() As
System.Drawing.Color
Get
Return Color.FromArgb(&H31, &H6A, &HC5)
End Get
End Property

Public Overrides ReadOnly Property MenuItemPressedGradientBegin() As
System.Drawing.Color
Get
Return MyBase.MenuItemPressedGradientBegin
End Get
End Property

Public Overrides ReadOnly Property MenuItemPressedGradientEnd() As
System.Drawing.Color
Get
Return MyBase.MenuItemPressedGradientEnd
End Get
End Property

Public Overrides ReadOnly Property MenuItemPressedGradientMiddle() As
System.Drawing.Color
Get
Return MyBase.MenuItemPressedGradientMiddle
End Get
End Property

Public Overrides ReadOnly Property MenuItemSelected() As
System.Drawing.Color
Get
Return Color.FromArgb(&HC1, 210, &HEE)
End Get
End Property

Public Overrides ReadOnly Property MenuItemSelectedGradientBegin() As
System.Drawing.Color
Get
Return Color.FromArgb(&HC1, 210, &HEE)
End Get
End Property

Public Overrides ReadOnly Property MenuItemSelectedGradientEnd() As
System.Drawing.Color
Get
Return Color.FromArgb(&HC1, 210, &HEE)
End Get
End Property

Public Overrides ReadOnly Property MenuStripGradientBegin() As
System.Drawing.Color
Get
Return Color.FromArgb(&HE5, &HE5, &HD7)
End Get
End Property

Public Overrides ReadOnly Property MenuStripGradientEnd() As
System.Drawing.Color
Get
Return Color.FromArgb(&HF4, &HF2, &HE8)
End Get
End Property

Public Overrides ReadOnly Property OverflowButtonGradientBegin() As
System.Drawing.Color
Get
Return Color.FromArgb(&HF3, &HF2, 240)
End Get
End Property

Public Overrides ReadOnly Property OverflowButtonGradientEnd() As
System.Drawing.Color
Get
Return Color.FromArgb(&H92, &H92, &H76)
End Get
End Property

Public Overrides ReadOnly Property OverflowButtonGradientMiddle() As
System.Drawing.Color
Get
Return Color.FromArgb(&HE2, &HE1, &HDB)
End Get
End Property

Public Overrides ReadOnly Property RaftingContainerGradientBegin() As
System.Drawing.Color
Get
Return Color.FromArgb(&HE5, &HE5, &HD7)
End Get
End Property

Public Overrides ReadOnly Property RaftingContainerGradientEnd() As
System.Drawing.Color
Get
Return Color.FromArgb(&HF4, &HF2, &HE8)
End Get
End Property

Public Overrides ReadOnly Property SeparatorDark() As
System.Drawing.Color
Get
Return Color.FromArgb(&HC5, &HC2, &HB8)
End Get
End Property

Public Overrides ReadOnly Property SeparatorLight() As
System.Drawing.Color
Get
Return Color.FromArgb(&HFF, &HFF, &HFF)
End Get
End Property

Public Overrides ReadOnly Property ToolStripBorder() As
System.Drawing.Color
Get
Return Color.FromArgb(&HA3, &HA3, &H7C)
End Get
End Property

Public Overrides ReadOnly Property ToolStripDropDownBackground() As
System.Drawing.Color
Get
Return Color.FromArgb(&HFC, &HFC, &HF9)
End Get
End Property

Public Overrides ReadOnly Property ToolStripGradientBegin() As
System.Drawing.Color
Get
Return Color.FromArgb(&HF7, &HF6, &HEF)
End Get
End Property

Public Overrides ReadOnly Property ToolStripGradientEnd() As
System.Drawing.Color
Get
Return Color.FromArgb(230, &HE3, 210)
End Get
End Property

Public Overrides ReadOnly Property ToolStripGradientMiddle() As
System.Drawing.Color
Get
Return Color.FromArgb(&HF2, 240, &HE4)
End Get
End Property
End Class

Ken
 
T

Teemu

Ken Tucker said:
Hi,

You can change the color scheme by creating a new ProfessionColorTable.
Then tell the toolstrip renderer to use the new color table. I created a
color table based on the c# code found here.

http://blogs.msdn.com/jfoscoding/articles/489637.aspx

To changing the color scheme of the renderer

ToolStrip1.Renderer = New ToolStripProfessionalRenderer(New
TanColorScheme)

Here is the code for the professionalcolortable

Thanks for your answer, I'll try that.

-Teemu
 
T

Teemu

Teemu said:
Thanks for your answer, I'll try that.

Yes, this works just how I wanted. I made just a little fine tuning, I
changed ToolStripGradientEnd to Color.FromArgb(192, 192, 168) and now it
looks a bit better.

-Teemu
 
K

Ken Tucker [MVP]

Hi,

Yes it does.

Ken
-------------
Teemu said:
Yes, this works just how I wanted. I made just a little fine tuning, I
changed ToolStripGradientEnd to Color.FromArgb(192, 192, 168) and now it
looks a bit better.

-Teemu
 

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