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 :)

Re: Skinning C# Windows Applications 80 80

you can search on "Skin Craft" it's tool used to skin your form

Re: Skinning C# Windows Applications 80 80

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 :)


Re: Skinning C# Windows Applications 80 80

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 :-)

Re: Skinning C# Windows Applications 80 80

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???)

Re: Skinning C# Windows Applications 80 80

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.

Re: Skinning C# Windows Applications 80 80

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 :)

Re: Skinning C# Windows Applications 80 80

Waiting for your questions, hope to you the best in your task :)

Re: Skinning C# Windows Applications 80 80

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 :)

Re: Skinning C# Windows Applications 80 80

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:

Re: Skinning C# Windows Applications 80 80

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 :-)

Re: Skinning C# Windows Applications 80 80

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 = 
Re: Skinning C# Windows Applications 80 80

but in that case (previous reply) you won't see controls color except in runtime not design time.

Re: Skinning C# Windows Applications 80 80

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 :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.