![]() |
Platforms, Frameworks & Libraries »
Libraries »
General
Intermediate
License: The Code Project Open License (CPOL)
Use the Free USkin Toolkit to Skin your ApplicationBy thirdwolfUSkin provides a free library and tools to developers for easily adding skins to their software UI. |
C#, VC6, VC7, .NET, Win2K, WinXP, Visual Studio, Dev
|
|
Advanced Search |
|
|
|
||||||||||||||||
The current version (V3.0 beta) does not need skinbuilder, the next version will provide one.
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.
USkin provides a free version. Save your money! 
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();
}
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:
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:
USkinUpdateMenuBar function. When the user modifies the menu by USkinGetMenu, the user should call USkinUpdateMenuBar to update the menubar. RightToLeft text support. USkin file format compatible. SkinBuilder. SkinBuilder Help document. SkinBuilder. ScrollBar control. MultiLine style in Button/CheckBox/RadioBox. USkin with your .NET applications! USkinCom. Easy for .NET use. USkin in these samples. USkinApplyColorTheme function. Everything will change when calling the USkinApplyColorTheme function. USkinDrawFrameControl function to replace the standard DrawFrameControl. uskin
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 10 Nov 2008 Editor: Deeksha Shenoy |
Copyright 2006 by thirdwolf Everything else Copyright © CodeProject, 1999-2009 Web11 | Advertise on the Code Project |