Hi all,

How can I make, for example, all my Buttons have the same look (Maybe the same red background)... Of course I don't want to go to every button and set it's background to red... I want to set the value in one place for all buttons.

Any ideas?
Thanks a lot :)

That's exactly what I was looking for... Thanks Rami...

Here's the website for Skin Craft if anyone is wondering http://skincrafter.com/

By the way, how come C# Windows Applications don't have this option. Something very simple at least... If you have other ideas, please share them with us :)

Cheers

No, you can develop this feature yourself, actually Zamriow, Microsoft can't serve each one needs, but they build the infrastructure to allow you develop or create your feature or to enhance VS through VS extensibility.

As I mentiond, you can work around how they make SkinCraft and do yours.

Hope to you the best :-)

Hey Rami, Thanks for the replies...

Well I though about implementing a small function that will take my Form object and then loop through all its controls (buttons, textboxes...) and apply the needed visual styles... But hey, If I do this, I will not be able to view my controls with their final look in the Visual Studio GUI designer!!! That's out.

What I want is something like CSS for HTML... You just specify the "class" for your control and voila!!! It's all polished and ready even in the GUI designer (of ASP.NET 2005).

Any ideas on how to do this? (Extensions to visual studio... hmmmm!!!)

Did any one else need something similar? (In large scale projects... no one???)

Zamriow, to understand what does behind the scene, when you switch from Code to Design, VS uses reflection to compile *.designer.cs
So, if you able to append /modify code generated for controls in this file.

Yes I know about the *.designer.cs files... hmmmmm, so I guess now I have to see how to write an extension for Visual Studio and instruct it to modify those files on the fly :) cooool... I'll keep you posted :)
Thanks.

I found something that might be interesting:

I've put a button on my form, right clicked, properties and then opened the "ApplicationSettings" tab (using the +). From there you can bind the button's property to application settings. Let's say I bound the the background color to a property named button_bgcolor.

Now I add many buttons to my application and whenever I need to change all their background colors I go to "Project -> Properties -> Settings" and edit the button_bgcolor and voila!!! All my buttons change their colors event in design view :) sweet :)

There's still something I don't like... Every time you add a button you must set this property... This is not exactly efficient when you want multiple properties to be set!!!

I'm investigating how can I instruct Visual Studio to use those properties by default when I drag and drop a button to my form :)

(For now, I'm just copy/pasting buttons... it works... hehehe :twisted: )

Any other ideas? :idea:

that's an approach, but afterwards you need some complex algorithms to maintain such staff, like Control.CreateGraphics to draw a shape, let's say you need a button as
Pyramid and so on..
But if you need just to chaneg the color, I prefer to use .settings file :-)

Look, you can loop for all controls and set their color to the value returned from .settings file
for example

foreach(Control c in this.Controls)
c.ForeColor = 
[Settings1].Default.[ControlsForeColor];

I was checking "Microsoft Visual C# 2008 Express Edition Beta 2" today and it's amazing.

Using WPF fulfills all my skinning needs.

Check this tutorial for example: http://www.codeproject.com/WPF/GuidedTourWPF_5.asp

WPF is amazing... I'm starting to play with it from now and getting ready for the non-beta release.

Cheers :)

This article has been dead for over six months. Start a new discussion instead.