Custom UI colour scheme for Windows Forms .NET

Audience

Everyone

The easyest way to customise you display of your ToolStrip, MainMenu and StatusBar is to use a custom ColorTable.

Just inherit from the ProfessionalColorRenderer and override what you want, with the colors you want:

   1:  Public Class MortgagesPlcColorTable
   2:          Inherits ProfessionalColorTable
   3:   
   4:          Public Overrides ReadOnly Property ButtonCheckedHighlightBorder() As System.Drawing.Color
   5:              Get
   6:                  Return MyBase.ButtonCheckedHighlightBorder
   7:              End Get
   8:          End Property
   9:   
  10:          Public Overrides ReadOnly Property MenuItemPressedGradientMiddle() As System.Drawing.Color
  11:              Get
  12:                  Return Color.FromArgb(91, 91, 91)
  13:              End Get
  14:          End Property
  15:   
  16:          Public Overrides ReadOnly Property ToolStripContentPanelGradientBegin() As System.Drawing.Color
  17:              Get
  18:                  Return Color.FromArgb(80, 80, 80)
  19:              End Get
  20:          End Property
  21:   
  22:          Public Overrides ReadOnly Property ToolStripContentPanelGradientEnd() As System.Drawing.Color
  23:              Get
  24:                  Return Color.WhiteSmoke
  25:              End Get
  26:          End Property
  27:   
  28:          Public Overrides ReadOnly Property ToolStripDropDownBackground() As System.Drawing.Color
  29:              Get
  30:                  Return Color.FromArgb(91, 91, 91)
  31:              End Get
  32:          End Property
  33:   
  34:          Public Overrides ReadOnly Property ToolStripGradientBegin() As System.Drawing.Color
  35:              Get
  36:                  Return Color.FromArgb(80, 80, 80)
  37:              End Get
  38:          End Property
  39:   
  40:      End Class

Once you have done this, all you need now is to add it to your contols:

   1:          System.Windows.Forms.ToolStripManager.Renderer = New ToolStripProfessionalRenderer(New MortgagesPlc.Windows.Forms.MortgagesPlcColorTable)

All done! If you have problems you can inherit from the ToolStrip control and change the renderer in the constructor…

Technorati Tags:  

Create a conversation around this article

Share on Facebook
Share on Twitter
Share on Linkdin

Read more

Martin Hinshelwood
For a long time now I have been searching for that perfect domain that epitomised the vision, the why, of what I am trying to achieve with my customers and the industry at large. Now I have found it in http://nkdagility.com
Martin Hinshelwood
At the MVP Summit I was appalled by the number of people who asked questions about new features for supporting hierarchical tasks! I shared a disgusted look with Peter Provost and we had a quick (and I mean really quick) conversation that resulted in this post. it really comes down …
Martin Hinshelwood
In my journey of delivering an immersive Product Development Mentor Program over the last eight weeks, a compelling narrative unfolded that beautifully illustrates the essence and true strength of Scrum. This story, rooted in the practical application of Scrum through Minecraft, unveils the depth of adaptability and resilience that Scrum …
Martin Hinshelwood
The Boards in Azure DevOps are a powerful tool that your teams can leverage to enable transparent visualization of the current state of value delivery.  However, the inclusion of Blocked columns can stealthily erode the very foundations of efficiency these boards are meant to uphold. By obfuscating the state of …