开发者

Re-styling the Standard toolbar in Windows Forms Applications (C# only)

开发者 https://www.devze.com 2023-02-08 06:26 出处:网络
Ok, so I\'ve finally come to my senses and stopped trying to reinvent the wheel whenever I see something that I think can look much better :P

Ok, so I've finally come to my senses and stopped trying to reinvent the wheel whenever I see something that I think can look much better :P

How can I make the Toolbar Control look nicer. Would I use GDI/GDI+ (I haven't really used them much, at all), or would I somehow inherit from the Toolbar Control and do some magic coding there to change Visual Appearance options, if that's at all possible?

I'm not looking for code (although it would be helpful, and appreciated), but rather some simple, yet in-depth articles/tutorials or maybe even some fre开发者_如何学JAVAe, sample apps with source code I can read/play around with.

Anybody have any ideas as to how I should go about this? Just to give you an idea of what I'm trying to accomplish, I've uploaded a screenshot that I drew-up in Real-Draw Pro:

Re-styling the Standard toolbar in Windows Forms Applications (C# only)


I think you can simply do that by setting BackGroundImage property and changing them at the MouseHover/MouseLeave event. For best effect put the ToolStrip into a ToolStripPanel control and set the blue Background image as its background Image.

Its as simple as that. I dont see any need to go to GDI+.

For the right aligned menu trick you can add one Label with "option" Text and set its Anchor to AnchorStyles.Right


To do this yourself in WinForms, you will end up re-inventing the wheel, and then some. Custom drawing with GFI+, inheriting and overriding OnPaint...

Your best best to achieve what you drawn (relatively) easily would be to use WPF - you can truly customize every aspect of the UI in XAML.

If WPF is not an option, perhaps you could look into 3rd party controls, specializing in styling and skinning the UI. Again, it will be cheaper than developing this from scratch in WinForms.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号