Click here to Skip to main content
5,787,682 members and growing! (18,827 online)
Email Password   helpLost your password?
Platforms, Frameworks & Libraries » Libraries » General     Intermediate License: The Code Project Open License (CPOL)

Use the Free USkin Toolkit to Skin your Application

By thirdwolf

USkin provides a free library and tools to developers for easily adding skins to their software UI.
C#, VC6, VC7, C++, .NET, Windows, Win2K, WinXP, Visual Studio, Dev

Posted: 28 Apr 2006
Updated: 10 Nov 2008
Views: 117,459
Bookmarked: 123 times
Announcements
Loading...



Search    
Advanced Search
Sitemap
31 votes for this Article.
Popularity: 4.69 Rating: 3.14 out of 5
11 votes, 35.5%
1
0 votes, 0.0%
2
2 votes, 6.5%
3
3 votes, 9.7%
4
15 votes, 48.4%
5

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

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

About the Author

thirdwolf



Occupation: Web Developer
Location: China China

Other popular Libraries articles:

Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
 Msgs 1 to 25 of 143 (Total in Forum: 143) (Refresh)FirstPrevNext
GeneralC#停靠栏(自适应的)被菜单盖住了一部分memberjokerangel198218:20 21 Dec '08  
Generalcan't download USkinDemo.zipmemberkryptun12:41 18 Dec '08  
GeneralStyle not applied to all parts of application.memberashesman22:09 30 Nov '08  
GeneralRe: Style not applied to all parts of application.memberthirdwolf0:19 1 Dec '08  
GeneralRe: Style not applied to all parts of application.memberashesman9:43 1 Dec '08  
GeneralRe: Style not applied to all parts of application.memberthirdwolf22:00 1 Dec '08  
GeneralUSkin Develope Progressmemberthirdwolf15:53 30 Nov '08  
GeneralRegd: FUISkinStudiomembertechiearc5:01 24 Nov '08  
GeneralRe: Regd: FUISkinStudiomemberthirdwolf18:01 24 Nov '08  
GeneralRE: Couple of questionsmemberjberenguer5:17 20 Nov '08  
GeneralRe: RE: Couple of questionsmemberthirdwolf15:39 20 Nov '08  
GeneralRe: RE: Couple of questionsmemberjberenguer10:45 21 Nov '08  
GeneralRe: RE: Couple of questionsmemberthirdwolf17:59 24 Nov '08  
GeneralRe: RE: Couple of questionsmemberjberenguer5:46 25 Nov '08  
GeneralIS 高薪诚聘UI界面 VC++开发高级工程师.memberroger_long18:42 6 Nov '08  
GeneralUnable to register dllmembertechiearc20:15 28 Oct '08  
GeneralRe: Unable to register dllmemberthirdwolf16:43 9 Nov '08  
GeneralRE: Latest Versionmemberjberenguer15:17 19 Oct '08  
GeneralRe: RE: Latest Versionmemberthirdwolf16:50 9 Nov '08  
GeneralRe: RE: Latest Versionmemberjberenguer8:49 10 Nov '08  
GeneralRE: Transparencymemberjberenguer15:13 23 Jul '08  
GeneralRe: RE: Transparencymemberthirdwolf21:04 24 Jul '08  
QuestionRE: Free? [modified]memberjberenguer9:49 5 Jul '08  
AnswerRe: RE: Free?memberthirdwolf1:43 22 Jul '08  
GeneralRe: RE: Free?memberjberenguer17:03 22 Jul '08  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 10 Nov 2008
Editor: Deeksha Shenoy
Copyright 2006 by thirdwolf
Everything else Copyright © CodeProject, 1999-2009
Web13 | Advertise on the Code Project