Click here to Skip to main content
11,565,352 members (38,303 online)
Click here to Skip to main content

Use the Free USkin Toolkit to Skin your Application

, 10 Nov 2008 CPOL 600K 31.5K 196
Rate this:
Please Sign up or sign in to vote.
USkin provides a free library and tools to developers for easily adding skins to their software UI.

The current version (V3.0 beta) does not need skinbuilder, the next version will provide one.

Sample Image

Introduction

As we know, Windows XP adds support for themes for applications. When we change the Windows theme, all the Windows standard applications change into the same theme. How can we add skin support to our own software and make our software different from others? Here, I suggest a way: use the USkin toolkit.

Why USkin?

  1. Saves your development time. You don't have to care too much about your software UI. After finishing your functions, add three lines of code to support a skin. It's very easy, and will save you time.
  2. Makes your app look and feel goodSmile | :) , that's it.
  3. Supports color themes. This can make a skin file look like a 100 different skins. Save your UI design time.
  4. USkin provides a free version. Save your money!
  5. Free powerful SkinStudio included that you can use to design your own skin file.

USkin Features

  • Supports more than 20 Windows standard controls
  • Supports system standard dialogs, such as file dialogs, color dialogs, print dialogs
  • Supports custom defined controls/third party controls
  • Supports WYSIWYG style skin file editing
  • Supports MDI/SDI/Dialog style apps
  • Supports window blinds skin file importing. More than 10000 skin files can be used
  • Supports color themes
  • Supports VC/SDK/VB/.NET, no language limitations
  • Supports multithreading
  • Supports changing skin at runtime
  • Supports all popup menus, including the edit control context menu!
  • Only two lines required to add skin support
  • Supports all scrollbar skins
  • Small skin file size, around 30 KB

Using the Code

Using USkin functions is very easy. Let's begin.

First, include the USkin.h file in your app:

#include "uskin.h"

Then, in the InitInstance function, call USkinInit to initiate the USkin library:

BOOL CSDIApp::InitInstance()
{
    InitCommonControls();

    CWinApp::InitInstance();

    if (!AfxOleInit())
    {
        AfxMessageBox(IDP_OLE_INIT_FAILED);
        return FALSE;
    }
    AfxEnableControlContainer();
    // Init USkin lib and load media skin file
    USkinInit(NULL,NULL,_T("..\\Skins\\vista.msstyles"));
    SetRegistryKey(_T("Local App"));
    LoadStdProfileSettings(4);

    CSingleDocTemplate* pDocTemplate;
    pDocTemplate = new CSingleDocTemplate(
        IDR_MAINFRAME,
        RUNTIME_CLASS(CSDIDoc),
        RUNTIME_CLASS(CMainFrame),
        RUNTIME_CLASS(CSDIView));
    if (!pDocTemplate)
        return FALSE;
    AddDocTemplate(pDocTemplate);

    this->RegisterShellFileTypes();
    TCHAR sz[500];
    ::GetModuleFileName(NULL,sz,500);
    AfxMessageBox(sz);

    CCommandLineInfo cmdInfo;
    ParseCommandLine(cmdInfo);

    if (!ProcessShellCommand(cmdInfo))
        return FALSE;

    m_pMainWnd->ShowWindow(SW_SHOW);
    m_pMainWnd->UpdateWindow();

    //if you want do your own subclass,call USkinInit here
    //USkinInit(NULL,NULL,_T("vista.msstyles"));

    return TRUE;
}

In the end, call USkinExit before your app exits:

int CSDIApp::ExitInstance()
{
    USkinExit();
    return CWinApp::ExitInstance();
}

Using the Code in .NET

The sample code is in C#. You can easily change to other .NET languages. OK, let's begin. First add USkinSDK.cs to your project. Then in the Main entry, add one line of code like this:

//First Declare a skin object
    [STAThread]
	static void Main()
	{
        USkinSDK.USkinInit("", "", "..\\Skins\\DiyGreen.msstyles");
		Application.Run(new Form1());
	}
}

For skinning the Button (GroupBox, CheckBox, RadioButton) object correctly, you need to change the FlatStyle property into System.

The resulting screen will look like this:

Points of Interest

This article does not focus on the technical side of the implementation. If you want to know how it works, you can try these CodeProject articles:

History

  • Updates in version 3.0 beta [2008-11-10]
    • New render engine. I rewrote the core render engine such that it is faster, of high quality, and safer.
    • Added Microsoft Window's Theme file format (*.msstyles) support. The user does not need to convert or edit the skin file. There are many skin files to use.
    • Added Multi-Monitor support.
    • Fixed USkin2.2 known bugs.
    • Removed custom draw functions in this version because it was using the Microsoft theme file.
  • Updates in version 2.2 [2006-08-07]
    • Fixed the menubar update error.
    • Added the USkinUpdateMenuBar function. When the user modifies the menu by USkinGetMenu, the user should call USkinUpdateMenuBar to update the menubar.
    • Added RightToLeft text support.
    • Added Winamp like player sample.
    • USkin file format compatible.
    • Enhanced the SkinBuilder.
    • Added SkinBuilder Help document.
    • Added multilanguage support to SkinBuilder.
    • Enhanced ScrollBar control.
  • Updates in version 2.1
    • Fixed the MultiLine style in Button/CheckBox/RadioBox.
    • Added .NET skin support. Now you can use USkin with your .NET applications!
    • Added a new library called USkinCom. Easy for .NET use.
    • Added two C# samples. One is MDI, the other is SDI. You can see the power of USkin in these samples.
    • Added color replace feature. Now, you can replace standard system colors.
    • Enhanced the USkinApplyColorTheme function. Everything will change when calling the USkinApplyColorTheme function.
    • Added the USkinDrawFrameControl function to replace the standard DrawFrameControl.
    • Added six skin files to the pack. All skin files are carefully edited.
    • Enhanced many functions.

Special Thanks

  • Thanks to The Code Project for providing a good platform for developers
  • Thanks to you guys who use uskin
  • Thanks AlecJames - He found a multi-monitor bug. Sorry man, I took a long time to make v3.0

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

thirdwolf
Web Developer
China China
No Biography provided

You may also be interested in...

Comments and Discussions

 
GeneralMy vote of 1 Pin
Fabio Vianello14-Mar-14 3:55
memberFabio Vianello14-Mar-14 3:55 
QuestionUSkinDemo - Skin changes not applying to vs 2010 Pin
ranjithkumar8123-Feb-14 20:16
memberranjithkumar8123-Feb-14 20:16 
AnswerRe: USkinDemo - Skin changes not applying to vs 2010 Pin
thirdwolf24-Feb-14 0:42
memberthirdwolf24-Feb-14 0:42 
AnswerRe: USkinDemo - Skin changes not applying to vs 2010 Pin
thirdwolf24-Feb-14 0:47
memberthirdwolf24-Feb-14 0:47 
QuestionDetory the message loop Pin
tang100071-Aug-12 15:26
membertang100071-Aug-12 15:26 
GeneralMy vote of 1 Pin
osirisgothra8-Jan-12 18:46
memberosirisgothra8-Jan-12 18:46 
QuestionShell Style .msstyles Pin
quike60411-Nov-11 15:51
memberquike60411-Nov-11 15:51 
GeneralMy vote of 1 Pin
haily_lee30-Oct-11 22:43
memberhaily_lee30-Oct-11 22:43 
GeneralRe: My vote of 1 Pin
osirisgothra8-Jan-12 18:41
memberosirisgothra8-Jan-12 18:41 
GeneralWhy Chinese? Pin
myssoft12-May-11 23:57
membermyssoft12-May-11 23:57 
GeneralGood article! Do you have a C# version of it? Pin
TheRomanian18-Apr-11 5:11
memberTheRomanian18-Apr-11 5:11 
Questionwhere can I get the source code of the uskin? and how much it is? Pin
Member 3898746-Apr-11 19:21
memberMember 3898746-Apr-11 19:21 
GeneralMy vote of 3 Pin
cdinten1-Mar-11 23:20
membercdinten1-Mar-11 23:20 
GeneralUnicode error with button, check box and radio box Pin
forzamilan13-Sep-10 17:55
memberforzamilan13-Sep-10 17:55 
GeneralGarbage in Demo-Source Pin
optimal-process.de7-Jun-10 9:36
memberoptimal-process.de7-Jun-10 9:36 
GeneralOdd characters in the sdinet/form1 source Pin
BlackDogSpark8-Nov-09 7:59
memberBlackDogSpark8-Nov-09 7:59 
GeneralUSkinGetMenu always return NULL Pin
raymond_zeng200017-Sep-09 5:46
memberraymond_zeng200017-Sep-09 5:46 
Generalrebar menu bug? [modified] Pin
zenithfree16-Sep-09 6:41
memberzenithfree16-Sep-09 6:41 
Generalmdichild form controls's are not themed Pin
N3CAT115-Sep-09 5:08
memberN3CAT115-Sep-09 5:08 
GeneralWierd problem with dll injector and skin Pin
mark2991-Sep-09 1:57
membermark2991-Sep-09 1:57 
Generalwould you support unicode version,pls Pin
rabbiruby21-Aug-09 0:05
memberrabbiruby21-Aug-09 0:05 
Questionwhy Windows xp can not run under the correct Pin
maotree7-Aug-09 13:36
membermaotree7-Aug-09 13:36 
Generalvb 2008 sqlCE problem Pin
Roxdes16-Jul-09 23:15
memberRoxdes16-Jul-09 23:15 
QuestionHow to exclude controls from skinning? Pin
architecton4-Jul-09 0:02
memberarchitecton4-Jul-09 0:02 
GeneralCommand Line Argu Pin
MPTP21-Apr-09 20:06
memberMPTP21-Apr-09 20:06 
QuestionCompatible with MS Visual Studio 2008? Pin
hoe198615-Mar-09 5:48
memberhoe198615-Mar-09 5:48 
AnswerRe: Compatible with MS Visual Studio 2008? Pin
Transgenic7-Jan-10 6:42
memberTransgenic7-Jan-10 6:42 
GeneralUse it(V3.0 beta) with MFC Grid control 2.26 Pin
hbg03085-Feb-09 17:52
memberhbg03085-Feb-09 17:52 
GeneralRe: Use it(V3.0 beta) with MFC Grid control 2.26 Pin
thirdwolf5-Feb-09 22:31
memberthirdwolf5-Feb-09 22:31 
GeneralC#停靠栏(自适应的)被菜单盖住了一部分 Pin
jokerangel198221-Dec-08 17:20
memberjokerangel198221-Dec-08 17:20 
Generalcan't download USkinDemo.zip Pin
kryptun18-Dec-08 11:41
memberkryptun18-Dec-08 11:41 
GeneralStyle not applied to all parts of application. Pin
ashesman30-Nov-08 21:09
memberashesman30-Nov-08 21:09 
GeneralRe: Style not applied to all parts of application. Pin
thirdwolf30-Nov-08 23:19
memberthirdwolf30-Nov-08 23:19 
GeneralRe: Style not applied to all parts of application. Pin
ashesman1-Dec-08 8:43
memberashesman1-Dec-08 8:43 
GeneralRe: Style not applied to all parts of application. Pin
thirdwolf1-Dec-08 21:00
memberthirdwolf1-Dec-08 21:00 
GeneralRe: Style not applied to all parts of application. Pin
ricomp27-Feb-09 4:44
memberricomp27-Feb-09 4:44 
GeneralRe: Style not applied to all parts of application. Pin
ashesman27-Feb-09 7:54
memberashesman27-Feb-09 7:54 
GeneralRe: Style not applied to all parts of application. Pin
Jean-Francois Goulet20-Jul-09 5:42
memberJean-Francois Goulet20-Jul-09 5:42 
GeneralRe: Style not applied to all parts of application. Pin
jberenguer15-Sep-09 7:06
memberjberenguer15-Sep-09 7:06 
GeneralUSkin Develope Progress Pin
thirdwolf30-Nov-08 14:53
memberthirdwolf30-Nov-08 14:53 
GeneralRegd: FUISkinStudio Pin
techiearc24-Nov-08 4:01
membertechiearc24-Nov-08 4:01 
GeneralRe: Regd: FUISkinStudio Pin
thirdwolf24-Nov-08 17:01
memberthirdwolf24-Nov-08 17:01 
GeneralRE: Couple of questions Pin
jberenguer20-Nov-08 4:17
memberjberenguer20-Nov-08 4:17 
I have a couple of questions - most of which is already answered but would like to clarify:


1 - this release has the transparency fix? (for semi transparent title bars, form drop shadows, etc..)
2 - this still uses the older/original ukin creator/builder app for making skins?


Thanks for this new release - I am looking forward to trying this at home on dual monitors....


Jimmy
GeneralRe: RE: Couple of questions Pin
thirdwolf20-Nov-08 14:39
memberthirdwolf20-Nov-08 14:39 
GeneralRe: RE: Couple of questions Pin
jberenguer21-Nov-08 9:45
memberjberenguer21-Nov-08 9:45 
GeneralRe: RE: Couple of questions Pin
thirdwolf24-Nov-08 16:59
memberthirdwolf24-Nov-08 16:59 
GeneralRe: RE: Couple of questions Pin
jberenguer25-Nov-08 4:46
memberjberenguer25-Nov-08 4:46 
GeneralRE: Couple of questions Pin
jberenguer3-Mar-09 16:44
memberjberenguer3-Mar-09 16:44 
GeneralIS 高薪诚聘UI界面 VC++开发高级工程师. Pin
roger_long6-Nov-08 17:42
memberroger_long6-Nov-08 17:42 
GeneralUnable to register dll Pin
techiearc28-Oct-08 19:15
membertechiearc28-Oct-08 19:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150624.2 | Last Updated 10 Nov 2008
Article Copyright 2006 by thirdwolf
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid