Introduction
I have some projects using PropertyGrid
but the color is not beautiful. The original was 2 theme (System, XPTheme) only until I found the article "Changing the look and feel of the propertygrid" from seeshaper.
Background
But I need to change color and theme of the PropertyGrid
when the parent form or MainMenu
has changed property ToolStripManager
. Thank you for every idea below.
Using the Code
Add the control to the tool box of Visual Studio or re-build this class in your project. The control look and feel will change with your MainMenu
automatically.
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
switch (this.comboBox1.SelectedIndex)
{
case 0:
ToolStripManager.Renderer = new ToolStripSystemRenderer();
ToolStripManager.RenderMode = ToolStripManagerRenderMode.System;
break;
case 1:
ToolStripManager.Renderer = new ToolStripProfessionalRenderer();
break;
case 2:
ToolStripManager.Renderer = new Office2007Renderer.Office2007Renderer();
break;
case 3:
ToolStripManager.Renderer =
new ToolStripProfessionalRenderer(new TanColorTable());
break;
default:
break;
}
}
Point of Interest
If you set your application to render with System Renderer, please set RenderMode
to System
.
ToolStripManager.RenderMode = ToolStripManagerRenderMode.System;
History
- 2009-April-22: Published
- 2009-April-23: Updated control at design-time
He start from web developer(asp classic) since 1997, and now use .net techonogy(c#, vb.net).