PostHeaderIcon Use the SkinMagic2.5.1.1 Toolkit to Skin your Application

Fisrt, copy four files into your project workspace:

uskin files

SkinMagic files

The files are SkinMagic Files;

Second, open the header file “stdafx.h”,copy the following two lines code:

// 导入SkinMagic头文件===begin===
#include "SkinMagicLib.h"
#pragma comment(lib, "SkinMagic.lib")
// 导入SkinMagic头文件===endl===

Third, insert the following code into yourApp::InitInstance() method:

        //code here

	// 标准初始化
	// 如果未使用这些功能并希望减小
	// 最终可执行文件的大小,则应移除下列
	// 不需要的特定初始化例程
	// 更改用于存储设置的注册表项
	// TODO: 应适当修改该字符串,
	// 例如修改为公司或组织名

	// 初始化SkinMagic库===begin===
	VERIFY(1==InitSkinMagicLib(AfxGetInstanceHandle(), NULL, NULL, NULL));
	// 初始化SkinMagic库===endl===
        // code here

Fourth, still insert the following code(diffrent from the Third one) into yourApp::InitInstance() method:

        //code here
        m_pMainWnd = &dlg;
	// 将皮肤应用到对话框上===begin===
	VERIFY(1==SetWindowSkin( m_pMainWnd->m_hWnd , _T("MainFrame")));
	VERIFY(1==SetDialogSkin( _T("Dialog")));
	// 将皮肤应用到对话框上===endl===
        // code here

Fifth, overload the ExitInstance() method with your own ExitInstance() method:

int CUITestApp::ExitInstance() {
        // 释放skinmagic加载的资源
	return CWinApp::ExitInstance();

OK,game over~enjoy it!!!


Leave a Reply

Your email address will not be published. Required fields are marked *



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Copyright © 2010 - C++ Technology. All Rights Reserved.

Powered by Jerry | Free Space Provided by