Skin++皮肤库在VS2010中使用
原文地址:http://blog.sina.com.cn/s/blog_4fe447750101768k.html
由于最近项目开发中需要软件界面比较美观,所以查阅了一些资料,但总结所有的美化界面的方法,skin++是最成熟和最方便快捷的方法,所以总结使用方法如下:
1,在stdafx.h中添加以下语句:
#include "SkinPPWTL.h" #pragma comment(lib, "SkinPPWTL")
2,将SkinPPWTL的头文件、lib文件和dll文件全部拷贝到当前工程目录下,并将头文件加入功能中;
3,在app的cpp文件中加入定义
#define SKINSPACE _T("/SPATH:") BOOL CInfoDisplaySystemApp::InitInstance() { skinppLoadSkin(_T("AquaOS.ssk"),0); AfxEnableControlContainer(); #ifdef _AFXDLL Enable3dControls(); // Call this when using MFC in a shared DLL #else Enable3dControlsStatic(); // Call this when linking to MFC statically #endif CInfoDisplaySystemDlg dlg; m_pMainWnd = &dlg; INT_PTR nResponse = dlg.DoModal(); if (nResponse == IDOK) { // TODO: 在此放置处理何时用 // “确定”来关闭对话框的代码 } else if (nResponse == IDCANCEL) { // TODO: 在此放置处理何时用 // “取消”来关闭对话框的代码 } // 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序, // 而不是启动应用程序的消息泵。 return FALSE; } int CInfoDisplaySystemApp::ExitInstance() { // TODO: Add your specialized code here and/or call the base class skinppExitSkin(); return CWinApp::ExitInstance(); }
加入以上的示例代码即可将skin++界面加入到MFC中了,
但VS2010下可能会出现以下错误,
>InfoDisplaySystem.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) int __cdecl skinppLoadSkin(wchar_t *,int)" (__imp_?skinppLoadSkin@@YAHPA_WH@Z)
1>F:\Info\InfoDisplaySystem\Release\InfoDisplaySystem.exe
: fatal error LNK1120: 1 unresolved externals
主要将字符集修改为No set就OK了
可见一下效果