How do I assign a skin file to my button?


We assume that you have already a skin file ( else you can search for *.ebn files in the samples folder of the Exontrol's ExButton ). 

There are two options to load your skin file to the button using the Skin or FocusSkin method of the ExButton:

Converting the skin file to a BASE64 encoded string is possible using the Exontrol's ExImages tool. It is free to use, so you have to download it and to run the ExImages.exe file.  The following screen shot shows you the mainframe from the Exontrol's ExImages tool:

Open a Windows Explorer, locate your skin file and drag the file over the area "Drag here a file such of .... ". The tool generates the BASE64 encoded string in two formats: VB or Template. 

The VB format shows like follows:

and it can be copied and pasted to your VB, VC code.

The Template form looks like:

and it can be used in Template pages. Also, the tool displays the length of the string that's required to hold the file you dragged. Important to notice is that the ExImages tool compresses the file before generating the BASE64 encoded string, but converting it to a BASE64 string it means that the size of the string will be with 1/4 greater than compressed file. The BASE64 encoded strings are useful to hold your icons, pictures, skins in string instead adding all kind of files to your application.

So, after we get the BASE64 encoded string all that you need to do is to pass the s variable to Skin, or FocusSkin method like in the following sample:


The sample shows how to apply a skin to the exNormal state of the button. Using the same way you can assign skin for any state of the button, and you can assign skins for states  that you are going to use, not for all. For instance, if you have AllowHotState property is False, the exHot state should not be assigned ( because it is never used ). Also, if you have UseFocusSkin property on True, instead calling the Skin method you should call FocusSkin method. Also, if multiple skins are applied in the same time we would recommend using the the BeginUpdate and EndUpdate methods. You will find a simple sample bellow this page.

Loading directly the file is possible by passing the path to the skin file to the Skin or FocusSkin method like in the following sample:

With Button1
    .Skin exNormal, "D:\Exontrol\ExButton\project\skins\XPSilver\normal.ebn"
End With

Use the BeginUpdate and EndUpdate methods to avoid painting the button while adding skins for each state of the button like in the following sample:

With Button1
        Dim strPath As String
        strPath = "D:\Exontrol\ExButton\sample\VB\Builder\Predefined\XPSilver\"
        .UseFocusSkin = True
        .Skin exNormal, strPath + "normal.ebn"
        .Skin exHot, strPath + "hot.ebn"
        .Skin exPushed, strPath + "pushed.ebn"
        .FocusSkin exNormal, strPath + "focus.ebn"
End With