海阔天空

海阔凭鱼跃 天高任鸟飞

 

使用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;
}

posted on 2010-03-30 20:56  liuym  阅读(4900)  评论(0编辑  收藏  举报

导航