Results 1 to 21 of 21

Thread: Customizable Menu/ToolStrip control - including Office2007 + all Office2003 styles!

  1. #1

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

    Customizable Menu/ToolStrip control - including Office2007 + all Office2003 styles!

    IMPORTANT
    There is a new, much better, version, which can be found here:
    http://www.vbforums.com/showthread.php?p=3685172







    Hey,

    Here is a MenuStrip and ToolStrip control that supports complete customization of all colors. The cMenuStrip / cToolStrip behaves exactly the same as the usual MenuStrip / ToolStrip, except for one modified property and one new property:
    • Appearance
    • Renderer


    The Appearance property holds a large load of other properties, all related to the ToolStrip's appearance, subdivided into logical groups:


    Using these properties, you can customize every color the ToolStrip uses. If you're crazy like me you can make a red and pink one like this in 2 seconds time:

    (Ok, maybe not the prettiest example, but you get the idea )


    The second property, Renderer, allows you to set a preset. You can choose (at this time) between the following:
    • Office 2007
    • Office 2003 Blue
    • Office 2003 Silver
    • Office 2003 Olive
    • Office XP
    • Office Classic


    You can see these presets (except the Office2007 style) in action (and in that order) here:


    Apart from the list above you can also choose Custom, which tells the control to use your custom Appearance. So if you don't want to use a preset, keep the Renderer property on Custom!


    The VB file you need is attached. All you need to do is add the existing class to any existing or new project by right-clicking the project in the Solution Explorer and choosing Add - Existing item...

    Build your solution via the Build menu, and if the build succeeded, the cToolStrip control should appear at the top of your Toolbox.


    Enjoy!


    I just wanted to add that I got the idea of using a ColorTable from pimvdb in this thread. He also told me how to find the correct colors for the other styles so I could make my presets.
    Thanks!


    EDIT
    New:
    The cToolStrip now contains a property RoundEdges which enables or disables the rounded edges of the ToolStrip. Thanks to JuggaloBrotha!
    Attachment updated.


    Newer:
    I finally got around to adding a cMenuStrip with the same features. It involved copy/pasting and find/replace once like I already thought, so I wonder why I didn't try it earlier hehe... Anyway, it's attached and works in the same way.

    One more feature I might want to add now is being able to 'save' and 'load' a customization, so that you can quickly copy the colors from your ToolStrip to your MenuStrip so that they look the same. Right now you would have to change the colors twice, once on the MenuStrip and once on the ToolStrip. I can imagine that being a pain... I'll see if I might be able to do that.

    Newest:
    I also added my Office2007ColorTable so that you can choose that as a preset too.
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    Jul 2009
    Posts
    71

    Re: Customizable ToolStrip control - including all Office2003 styles!

    That looks just great, thanks for sharing. I didn't know other XP styles had different color tables!

    I don't know much about renderers, but perhaps you can add the colors of your vs2008 renderer too. I know it has the wrong shapes but nevertheless I think that would be great, too.

    btw, is the Office XP from Vista and Office Classic from XP with visual styles disabled?

    Thanks.

    EDIT: I see a possible bug, at line 74 it says Classic but in the enum it is OfficeClassic
    I also can't press a toolstripbutton if renderer=custom, or isn't it supposed to do so?
    Last edited by pimvdb; Aug 28th, 2009 at 02:38 AM.

  3. #3

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

    Re: Customizable ToolStrip control - including all Office2003 styles!

    Quote Originally Posted by pimvdb View Post
    btw, is the Office XP from Vista and Office Classic from XP with visual styles disabled?
    Not sure what you mean. I got the Office XP style by using my default XP Media Center Edition style. I assumed it looked like Office XP only because I think you mentioned that in your other thread, it might be completely different lol, dunno.
    Same goes for the classic style. I just set the style to Windows Classic (in XP) and ran your code again and the ToolStrip looked a little different. It might not look like that in Office at all

    Quote Originally Posted by pimvdb View Post
    EDIT: I see a possible bug, at line 74 it says Classic but in the enum it is OfficeClassic
    I also can't press a toolstripbutton if renderer=custom, or isn't it supposed to do so?
    Woops, you're right. That's odd, how come I didn't notice that lol. I'll upload the fixed file in a second.
    And about not being able to click, I think that's just because (for some reason ) the Appearance.Button.PressedAppearance is the same as the Appearance.Button.SelectedAppearance, so you merely don't see that you clicked it. I guess I choose the wrong default colors there, I'll take a look at that later.

  4. #4
    Registered User
    Join Date
    Jul 2009
    Posts
    71

    Re: Customizable ToolStrip control - including all Office2003 styles!

    Okay, thanks. What i mean with visual styles disabled, is that you set Enable XP styles on the Application pane in My Settings to false (I don't recommend actually using that in real applications as all controls look like the old-school ones). Then, however, the Office 2003-style is also being replaced with an Office XP-look. What I don't know, is whether that look (XP without visual styles) is the same as Vista (with/without visual styles). I'm going to discover that in a moment.

  5. #5
    Junior Member
    Join Date
    Sep 2009
    Posts
    22

    Re: Customizable ToolStrip control - including all Office2003 styles!

    Maybe a stupid question but... How do I use this? I can't seem to find a cToolStrip control?

  6. #6

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

    Re: Customizable ToolStrip control - including all Office2003 styles!

    Quote Originally Posted by ITsME898 View Post
    Maybe a stupid question but... How do I use this? I can't seem to find a cToolStrip control?
    See my first post:
    Quote Originally Posted by NickThissen View Post
    The VB file you need is attached. All you need to do is add the existing class to any existing or new project by right-clicking the project in the Solution Explorer and choosing Add - Existing item...

    Build your solution via the Build menu, and if the build succeeded, the cToolStrip control should appear at the top of your Toolbox.
    Did you read that? Anything you misunderstood or didn't get to work?

  7. #7
    Junior Member
    Join Date
    Sep 2009
    Posts
    22

    Re: Customizable ToolStrip control - including all Office2003 styles!

    oh sorry, missed the build part. Works perfect now, good work!
    Last edited by ITsME898; Sep 9th, 2009 at 09:23 AM.

  8. #8
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: Customizable ToolStrip control - including all Office2003 styles!

    Nick,
    I was wondering how one would change this control to remove the rounded corners on the bottom. You can change the RoundedEdges property of the ToolStripProfessionalRenderer:
    Code:
    If TypeOf ToolStrip1.Renderer Is ToolStripProfessionalRenderer Then
        CType(ToolStrip1.Renderer, ToolStripProfessionalRenderer).RoundedEdges = False
    End If
    Courtesy of Deepak Sakpal: Rectangular Toolstrip corners , however yours obviously doesn't use that so how would I make yours draw them square?

    Here's a screenshot:
    Attachment 75052
    The top ToolStrip doesn't have the rounded edges via the code posted above, the bottom one is the standard ToolStrip with no modifying code.
    Last edited by JuggaloBrotha; Jun 30th, 2010 at 03:05 PM.
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  9. #9

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

    Re: Customizable ToolStrip control - including all Office2003 styles!

    The cToolStrip class uses ToolStripProfessionalRenderers behind the scenes, so you can simply set the RoundedEdges property of those Renderers. If I find some time I could make it into a property for the ToolStrip itself, that's a good idea.

  10. #10
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: Customizable ToolStrip control - including all Office2003 styles!

    Quote Originally Posted by NickThissen View Post
    The cToolStrip class uses ToolStripProfessionalRenderers behind the scenes, so you can simply set the RoundedEdges property of those Renderers. If I find some time I could make it into a property for the ToolStrip itself, that's a good idea.
    Ok, I see it now.

    Adding it as a property of the control itself would be a good idea, I wonder why MS didn't do that with theirs in the first place either.
    Last edited by JuggaloBrotha; Dec 16th, 2009 at 01:23 PM.
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  11. #11

  12. #12

  13. #13
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: Customizable Menu/ToolStrip control - including Office2007 + all Office2003 style

    What about the other two Office2007 colors? I like the Black one the most and Silver's ok but not as good as the Blue & Black.
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  14. #14

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

    Re: Customizable Menu/ToolStrip control - including Office2007 + all Office2003 style

    I got the colors by taking screenshots of Visio 2007 as that doesn't use the Ribbon (I suppose Outlook would have worked too). As far as I know, you can't change the color of the menus there, can you? If you can then I can take some more screenshots in the different colors and create those presets too, but if you can't then it would mean more or less guess work, which is too much work

    That said, I'm using the Office 2010 beta now so I can't try it anymore. I suppose I could add a Office2010 color preset now, but as far as I know all office 2010 applications use the ribbon now, so again I have no examples...

  15. #15
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: Customizable Menu/ToolStrip control - including Office2007 + all Office2003 style

    Office 2007, except Visio and Project, have 3 color options: Blue, Black and Silver. Blue is just the default, here's how to change it:Office 2007: How To Change the Color Scheme I have Office 2010 downloaded but haven't installed it yet. If you need screen shots of Office 2007 though, I can easily send you them this evening when I get home.
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  16. #16

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

    Re: Customizable Menu/ToolStrip control - including Office2007 + all Office2003 style

    I know, but that is only for the Ribbon bar, which looks nothing like the ToolStrip. Visio and Outlook (in some places) uses a regular ToolStrip and MenuStrip just with some different colors; that is what I call the Office 2007 color table. As far as I know you can only change the colors of the Ribbon, and not of the ToolStrips in Visio and Outlook. Perhaps you can do it in Outlook though, I didn't try (since that uses a combination of the regular and ribbon, right? Ribbon in the mail windows and regular in the main window).

  17. #17
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: Customizable Menu/ToolStrip control - including Office2007 + all Office2003 style

    It changes it for the entire window border, the title bar including the 3 buttons on the top right, and the background behind the paper in the middle.

    Here's screen shots of all three colors.
    Last edited by JuggaloBrotha; Jun 30th, 2010 at 03:05 PM.
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  18. #18

  19. #19
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: Customizable Menu/ToolStrip control - including Office2007 + all Office2003 style

    Quote Originally Posted by NickThissen View Post
    So where is the regular ToolStrip or MenuStrip where I can copy the colors from? I don't see any.
    Where did you get the color scheme for the Office2007Blue that you already have?
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  20. #20

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

    Re: Customizable Menu/ToolStrip control - including Office2007 + all Office2003 style

    From Visio 2007.
    Quote Originally Posted by NickThissen View Post
    Visio and Outlook (in some places) uses a regular ToolStrip and MenuStrip just with some different colors; that is what I call the Office 2007 color table. As far as I know you can only change the colors of the Ribbon, and not of the ToolStrips in Visio and Outlook.

  21. #21

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