Skip to main content
Email Password   helpLost your password?

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

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

Special Thanks

You must Sign In to use this message board.
 
 
Per page   
 FirstPrevNext
GeneralOdd characters in the sdinet/form1 source Pin
BlackDogSpark
8:59 8 Nov '09  
GeneralUSkinGetMenu always return NULL Pin
raymond_zeng2000
6:46 17 Sep '09  
Generalrebar menu bug? [modified] Pin
zenithfree
7:41 16 Sep '09  
Generalmdichild form controls's are not themed Pin
N3CAT1
6:08 15 Sep '09  
GeneralWierd problem with dll injector and skin Pin
mark299
2:57 1 Sep '09  
Generalwould you support unicode version,pls Pin
rabbiruby
1:05 21 Aug '09  
Questionwhy Windows xp can not run under the correct Pin
maotree
14:36 7 Aug '09  
Generalvb 2008 sqlCE problem Pin
Roxdes
0:15 17 Jul '09  
GeneralHow to exclude controls from skinning? Pin
architecton
1:02 4 Jul '09  
GeneralCommand Line Argu Pin
MPTP
21:06 21 Apr '09  
GeneralCompatible with MS Visual Studio 2008? Pin
hoe1986
6:48 15 Mar '09  
GeneralUse it(V3.0 beta) with MFC Grid control 2.26 Pin
hbg0308
18:52 5 Feb '09  
GeneralRe: Use it(V3.0 beta) with MFC Grid control 2.26 Pin
thirdwolf
23:31 5 Feb '09  
GeneralC#停靠栏(自适应的)被菜单盖住了一部分 Pin
jokerangel1982
18:20 21 Dec '08  
Generalcan't download USkinDemo.zip Pin
kryptun
12:41 18 Dec '08  
GeneralStyle not applied to all parts of application. Pin
ashesman
22:09 30 Nov '08  
GeneralRe: Style not applied to all parts of application. Pin
thirdwolf
0:19 1 Dec '08  
GeneralRe: Style not applied to all parts of application. Pin
ashesman
9:43 1 Dec '08  
GeneralRe: Style not applied to all parts of application. Pin
thirdwolf
22:00 1 Dec '08  
GeneralRe: Style not applied to all parts of application. Pin
ricomp
5:44 27 Feb '09  
GeneralRe: Style not applied to all parts of application. Pin
ashesman
8:54 27 Feb '09  
GeneralRe: Style not applied to all parts of application. Pin
Jean-Francois Goulet
6:42 20 Jul '09  
GeneralRe: Style not applied to all parts of application. Pin
jberenguer
8:06 15 Sep '09  
GeneralUSkin Develope Progress Pin
thirdwolf
15:53 30 Nov '08  
GeneralRegd: FUISkinStudio Pin
techiearc
5:01 24 Nov '08  


Last Updated 10 Nov 2008 | Advertise | Privacy | Terms of Use | Copyright © CodeProject, 1999-2009