Results 1 to 40 of 59

Thread: [Ready] Visual Studio 2010 Menu/ToolStrip

Threaded View

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,070

    [Ready] Visual Studio 2010 Menu/ToolStrip

    Hey there,


    I've been working on a ToolStripRenderer that makes your Menu & Toolstrips look like the VS2010 theme.

    Screenshots:




    (There's also a zoomed in comparison screenshot a few posts down)


    Known issues:
    - Some things do not render properly when the ToolStrip is in vertical layout mode.
    - I cannot control rendering of a ToolStripComboBox or ToolStripTextBox, so they look quite out of place. Looking for a way around this, none found yet.


    Todo:
    - Make stuff work in vertical layout too (grip, separators, etc, don't work yet)
    - VS2010 checkmark image (little bit different from default)
    - ContextMenuStrip (though this may already work by assigning the menustrip renderer manually!)
    - StatusBar
    - ComboBox?
    - TabControl?

    You can get the control library project from the attachment.
    Please note: I created this in VS2010, but you should be able to open the project in VS2008. You should even be able to manually add the files using VS2005 (though probably not lower than that!).

    It is a .NET 2.0 project, and I 'converted' it back to be compatible with VS2008. I tested it, and I can open it with VS2008, so I think you should have no trouble with it.




    Usage:
    VS2008 or higher:
    • Add the 'Vs2010Renderers/Vs2010Renderers.vbproj' file to an existing solution (using Add Existing Project).
    • Alternatively, simply open the Vs2010Renderers.sln solution file and add a new project to it, to start with a blank project.
    • Build the solution succesfully.
    • Find the Vs2010MenuStrip and Vs2010ToolStrip controls in your Toolbox.


    VS2005:
    • Create or Add a new Control Library Project.
    • Remove the automatically added UserControl1 file.
    • Use Add Existing Files to add all files to your project. The files you need are all the files in the ColorTables, Controls and Renderers folders. I advice you to keep the folder layout the same, although that is not a requirement.
    • Build the solution succesfully.
    • Find the Vs2010MenuStrip and Vs2010ToolStrip controls in your Toolbox.



    In addition to the Vs2010MenuStrip and Vs2010ToolStrip controls, which already implemented the Vs2010 renderers (beside some other small features), you can also simply set the Renderer property of any existing MenuStrip or ToolStrip control to a new instance of the Renderers.Vs2010MenuStripRenderer and Renderers.Vs2010ToolStripRenderer classes, like so
    vb.net Code:
    1. MenuStrip1.Renderer = New Vs2010Renderers.Renderers.Vs2010MenuStripRenderer()
    2. ToolStrip1.Renderer = New Vs2010Renderers.Renderers.Vs2010ToolStripRenderer()
    This way, you don't have to recreate your menu and toolstrips, but you can keep using the existing ones.


    The Vs2010MenuStrip control doesn't do anything else except use this renderer by default.
    The Vs2010ToolStrip control also exposes one new property: AutoParentBackColor. If this is set to True, the Vs2010ToolStrip will change the Background color of any parenting ToolStripPanel to the Vs2010ToolStripColorTable.ParentBackground color. I advice you to leave this on because it simply looks better.




    Advanced:
    These renderers, by default, use the default color scheme for VS2010. However, I added a lot of flexibility here. The constructor of the Vs2010MenuStripRenderer accepts a Vs2010MenuStripColorTable. Likewise, the constructor of the Vs2010ToolStripRenderer accepts a Vs2010ToolStripColorTable (both color tables can also be get/set via the ColorTable property).

    Should you wish to implement your own color scheme, you can inherit Vs2010MenuStripColorTable (or Vs2010ToolStripColorTable) and return appropriate colors for each property you must override.
    Alternatively, you can also inherit Vs2010Default(Menu/Tool)StripColorTable. This way, you get the default colors, but you can override any color you want. This is a quick way to change one or two colors only, instead of having to define all colors manually.

    Note that, if you do inherit the (non-default) Vs2010(Menu/Tool)StripColorTable, you must also override a property that returns an instance of a Vs2010CommonColorTable. This color table contains colors that are common to both strips (such as the selection colors). The same goes for this color table really: you can either inherit Vs2010CommonColorTable to override all colors, or inherit Vs2010DefaultColorTable to override just the colors you need to change.



    Wew, that was enough rambling for one evening.

    If you have any questions whatsoever, about how to use this or the custom color tables, or want to know how I did something, don't hesitate to ask (you can do that right here by leaving a reply).

    If you have a suggestion, also don't hesitate to tell me.


    Enjoy!
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width