Click here to Skip to main content
Licence CPOL
First Posted 23 Apr 2009
Views 16,235
Downloads 414
Bookmarked 40 times

Renderer for PropertyGrid

By | 23 Apr 2009 | Article
Render all elements and color in PropertyGrid with ToolStripRenderer of Windows owner
RendererPropertyGrid

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.

//
// Change test
//
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
    switch (this.comboBox1.SelectedIndex)
    {
        case 0: //System
            ToolStripManager.Renderer = new ToolStripSystemRenderer();
            // Must set this !!
            ToolStripManager.RenderMode = ToolStripManagerRenderMode.System;
            break;
        case 1: // Professional
            ToolStripManager.Renderer = new ToolStripProfessionalRenderer();
            //ToolStripManager.RenderMode = ToolStripManagerRenderMode.Professional;
            break;
        case 2: // Office2007 Blue
            ToolStripManager.Renderer = new Office2007Renderer.Office2007Renderer();
            //ToolStripManager.RenderMode = ToolStripManagerRenderMode.Custom;
            break;
        case 3: // VS2005 Tan
            ToolStripManager.Renderer = 
		new ToolStripProfessionalRenderer(new TanColorTable());
            //ToolStripManager.RenderMode = ToolStripManagerRenderMode.Custom;
            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

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

v# guy

Software Developer

Thailand Thailand

Member

He start from web developer(asp classic) since 1997, and now use .net techonogy(c#, vb.net).

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralGreat work dear!!! PinmemberVJSWAMI4U19:54 29 Apr '09  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web01 | 2.5.120517.1 | Last Updated 23 Apr 2009
Article Copyright 2009 by v# guy
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid