使用Codejock的换肤界面

使用Codejock的换肤界面创建漂亮的UI

效果图  

 

环境:VC2005+SP1+Codejock Xtreme ToolkitPro v13.2.1
1)
配制好Codejock的环境

2)
使用VC2005创建一个SDI

3)
// stdafx.h
#include <XTToolkitPro.h>   // Codejock Software Components

4)
// MainFrm.h 
class CMainFrame : public CXTPFrameWnd

5)
// MainFrm.cpp
CMainFrame::CMainFrame()
{
// TODO: add member initialization code here
    XTPSkinManager()->LoadSkin(_T("D:\\Program Files\\Codejock Software\\MFC\\Xtreme ToolkitPro v13.2.1\\Bin\\vc80\\styles\\iTunes"), 
                           _T("Normalitunes.INI"));
    CXTPPaintManager::SetTheme(xtpThemeNativeWinXP);
    XTPPaintManager()->GetIconsInfo()->bUseFadedIcons = FALSE;
}

6)
//删除原有的OnCreate代码,用以下代码替换
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;

// Create Status bar.
// Important: All control bars including the Status Bar
// must be created before CommandBars....
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1;      // fail to create
}

// Initialize the command bars
if (!InitCommandBars())
return -1;

XTPPaintManager()->SetTheme(xtpThemeNativeWinXP);
XTPPaintManager()->GetIconsInfo()->bUseFadedIcons = FALSE;

// Get a pointer to the command bars object.
CXTPCommandBars* pCommandBars = GetCommandBars();
if(pCommandBars == NULL)
{
TRACE0("Failed to create command bars object.\n");
return -1;      // fail to create
}

// Add the menu bar
CXTPCommandBar* pMenuBar = pCommandBars->SetMenu(
_T("Menu Bar"), IDR_MAINFRAME);
if(pMenuBar == NULL)
{
TRACE0("Failed to create menu bar.\n");
return -1;      // fail to create
}

// Create ToolBar
CXTPToolBar* pToolBar = (CXTPToolBar*)
pCommandBars->Add(_T("Standard"), xtpBarTop);
if (!pToolBar || !pToolBar->LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1;
}
pCommandBars->GetShortcutManager()->SetAccelerators(IDR_MAINFRAME);

// Load the previous state for toolbars and menus.
LoadCommandBars(_T("CommandBars"));

PostMessage(WM_SYSCOLORCHANGE);

    GetCommandBars()->GetAt(0)->SetShowGripper(FALSE);
GetCommandBars()->GetAt(1)->SetShowGripper(FALSE);


return 0;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值