Use the free USkin Toolkit to skin your application

导读:
As we know, Window 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?
Save 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.
Make your app look and feel good :), that's it.
Support color themes. This can make a skin file look like a 100 different skins. Save your UI design time.
USkin provides a free version. Save your money!
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.hfile in your app.
#include "uskin.h"
Then, in the InitInstancefunction, call USkinInitto initiate the USkin library.
BOOL CSDIApp::InitInstance()
{
        InitCommonControls();
        CWinApp::InitInstance();
        if(!AfxOleInit())
        {
        AfxMessageBox(IDP_OLE_INIT_FAILED);
        returnFALSE;
        }
        AfxEnableControlContainer();
        // Init USkin lib and load media skin file
USkinInit(NULL,NULL,_T("media.u3"));
        SetRegistryKey(_T("Local App"));
        LoadStdProfileSettings(4);
        CSingleDocTemplate* pDocTemplate;
        pDocTemplate = newCSingleDocTemplate(
        IDR_MAINFRAME,
        RUNTIME_CLASS(CSDIDoc),
        RUNTIME_CLASS(CMainFrame),
        RUNTIME_CLASS(CSDIView));
        if(!pDocTemplate)
        returnFALSE;
        AddDocTemplate(pDocTemplate);
        this->RegisterShellFileTypes();
        TCHAR sz[500];
        ::GetModuleFileName(NULL,sz,500);
        AfxMessageBox(sz);
        CCommandLineInfo cmdInfo;
        ParseCommandLine(cmdInfo);
        if(!ProcessShellCommand(cmdInfo))
        returnFALSE;
        m_pMainWnd->ShowWindow(SW_SHOW);
        m_pMainWnd->UpdateWindow();
        //if you want do your own subclass,call USkinInit here
//USkinInit(NULL,NULL,_T("media.u3"));
returnTRUE;
}
In the end, call USkinExitbefore your app exits.
intCSDIApp::ExitInstance()
{
        USkinExit();
        returnCWinApp::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 Declare an skin object
privateUSKINCOMLib.USkinCOMObjectClass skin=null;
//Then in one form load function ,Init skin object and apply an skin
privatevoidForm1_Load(objectsender, System.EventArgs e)
{
        skin=newUSKINCOMLib.USkinCOMObjectClass();
        skin.USkinInit("","","media.u3");
}
//At the end ,destroy the object
protectedoverridevoidDispose( booldisposing )
{
        skin.USkinExit();
        if( disposing )
        {
        if(components != null)
{
        components.Dispose();
        }
        }
        base.Dispose( disposing );
}
For skinning the Button(GroupBox, CheckBox, RadioButton) object correctly, you need to change the FlatStyleproperty 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:
SkinX, A framework of a skin plug-in package.
.dan.g's SkinControls 1.1 - A journey in automating the skinning of Windows controls- this article is very detailed.
History
Updates in version 2.2 [2006-08-07]:
Fixed the menubar update error.
Added the USkinUpdateMenuBarfunction. When the user modifies the menu by USkinGetMenu, the user should call USkinUpdateMenuBarto update the menubar.
Added RightToLeft text support.
Added Winamp like player sample.
USkin file format compatible.
Enhanced the SkinBuilder.
Add SkinBuilder Help document.
Added multilanguage support to SkinBuilder.
Enhanced ScrollBarcontrol.
Updates in version 2.1:
Fixed the MultiLinestyle 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 USkinApplyColorThemefunction. Every thing will change when calling the USkinApplyColorThemefunction.
Added the USkinDrawFrameControlfunction to replace the standard DrawFrameControl.
Added six skin files to the pack. All skin files are carefully edited.
Enhanced many functions.
        本文转自
http://www.codeproject.com/library/USkin.asp  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值