2 Attachment(s)
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:
The Appearance property holds a large load of other properties, all related to the ToolStrip's appearance, subdivided into logical groups:
http://i26.tinypic.com/21c5nhu.jpg
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:
http://i25.tinypic.com/2ntkxm9.jpg
(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:
http://i28.tinypic.com/1045402.jpg
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.
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?
Re: Customizable ToolStrip control - including all Office2003 styles!
Quote:
Originally Posted by
pimvdb
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 :blush:
Quote:
Originally Posted by
pimvdb
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 :confused:) 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.
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.
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?
Re: Customizable ToolStrip control - including all Office2003 styles!
Quote:
Originally Posted by
ITsME898
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
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?
Re: Customizable ToolStrip control - including all Office2003 styles!
oh sorry, missed the build part. Works perfect now, good work! :D
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.
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.
Re: Customizable ToolStrip control - including all Office2003 styles!
Quote:
Originally Posted by
NickThissen
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.
Re: Customizable ToolStrip control - including all Office2003 styles!
Cool thanks. I edited my first post and attached the new version, I hope you don't mind :)
Re: Customizable Menu/ToolStrip control - including Office2007 + all Office2003 style
I now also added my Office 2007 ColorTable as a preset :)
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.
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...
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.
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).
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.
Re: Customizable Menu/ToolStrip control - including Office2007 + all Office2003 style
So where is the regular ToolStrip or MenuStrip where I can copy the colors from? I don't see any.
Re: Customizable Menu/ToolStrip control - including Office2007 + all Office2003 style
Quote:
Originally Posted by
NickThissen
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?
Re: Customizable Menu/ToolStrip control - including Office2007 + all Office2003 style
From Visio 2007.
Quote:
Originally Posted by
NickThissen
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.
Re: Customizable Menu/ToolStrip control - including Office2007 + all Office2003 style
There is a new, much better, version, which can be found here:
http://www.vbforums.com/showthread.php?p=3685172