The Question.
I have been asked about custom skins a great number of times.
When are they really needed and how do they function?
Let's have this short article describing the topic.
First of all, we need to accept that SkinCrafter skins are skins for applications based on Windows Common Controls types.
When skin is applied, all controls are skinned with a particular graphics. I.e. all buttons look similar and all textboxes look similar.
It's not a rare case that developer needs to make some controls looking differently.
For example, he needs a greed button among the blue ones.
Or he wants to highlight the textbox with wrong input in red.
Or ...
I can list such cases endlessly.
Well, that's what the custom skins are meant for. You need them to make controls of one type look deferently than other skinned controls of this type.
Implementation.
In SkinBuilder, you should go to Custom Controls pane, and add the custom control you need.
For example, a textbox.
It will result in a new textbox item appeared in the controls tree. Which is completely the same as in Default Controls, but is here for you to put different images and colors settings.
When fulfilled, name this items according to your taste (let's say something like "redCustomTextBox" will do) and save the skin.
Now you will have two skins for textbox within a single skin file.
That's a half of the job.
If you now apply this skin to your application, all textboxes still will be skinned with default textbox skin.
That's because you need to specify in code, which control should use our custom skin .
There is an interface method - SetCustomSkinWnd - which should be used.
This method assigns a custom skin to a particular control or window.
In our case, a sample code snippet will look like this:
SkinOb.SetCustomSkinWnd(myTextBox.Handle.ToInt32(), "redCustomTextBox", false); //that's C# sample
The above code should be called after the textbox is created. And when compiled myTextBox should be skinned with custom skin and look different.
See more info about SetCustomSkinWnd method in SkinCrafter Help File.
Friday, November 02, 2007
When do we need custom skins?
Posted by
Paul GreatSkin
at
3:17 PM
Labels: Custom skins, different look, skin file
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment