免费视频淫片aa毛片_日韩高清在线亚洲专区vr_日韩大片免费观看视频播放_亚洲欧美国产精品完整版

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
應(yīng)用程序遷移至Xtreme Toolkit pro
 
應(yīng)用程序遷移至Xtreme Toolkit pro
2009-01-19 15:49:43
 
專業(yè)版中的很多組件,比如toolbars,menubars和docking windows等與標(biāo)準(zhǔn)版有很大的
不同。這是因為新的架構(gòu)作了相當(dāng)大的改變,提供了很多新的增強(qiáng)的特色。
本遷移向?qū)г噲D揭示這些異同以提供幫助,使你在遷移標(biāo)準(zhǔn)版的程序到專業(yè)版上時
更容易一些。

以下是這篇文章的所涉及的主題:
準(zhǔn)備你的程序
開始
command bar的初始化
menubar的創(chuàng)建
toolbar的創(chuàng)建
dock window的創(chuàng)建
添加對toolbar和menu的定制
添加智能菜單
為應(yīng)用程序添加一個theme

準(zhǔn)備你的應(yīng)用程序

首先你要做的是改變你的StdAfx.h文件中的include文件。這個文件常用來引進(jìn)
所有的toolkit的類定義并把你的程序連接到toolkit。你需要打開你的StdAfx.h文件,
把#include <XTToolKit.h>改為#include <XTPToolkit.h>,例如:

#include <XTToolkitPro.h> // Xtreme Toolkit Pro components

重新命名你的基類
下來你需要改變一些基類。你得把所有出現(xiàn)的CXT…改為C…,比如在一個MDI程序中,
CXTMDIChildWnd要變成CMDIChildWnd,CXTMDIFrameWnd要變成CMDIFrameWnd。
對一個SDI程序,CXTFrameWnd要變成CFrameWnd。下面是一個所有需要改變?yōu)槠鸪醯?br>MFC命名慣例的類的列表。這是你的程序返
回到遷移時的一個好的起點。

Toolkit Class Name MFC Class Name (rename to)
CXTFrameWnd CFrameWnd
CXTMDIChildWnd CMDIChildWnd
CXTMDIFrameWnd CMDIFrameWnd
CXTOleIPFrameWnd COleIPFrameWnd
CXTControlBar CControlBar
CXTDialogBar CDialogBar
CXTReBar CReBar
CXTReBarCtrl CReBarCtrl

其他缺失的類

以下的類在Xtreme Toolkit的專業(yè)版中不再出現(xiàn)。在新的體系中,他們或是被代替或
是被廢棄。這些類中的大多數(shù)你不能再直接使用;但在這里把它們列出來作為你的參
考:

Toolkit Class Name
CXTAccelSwapOutItemList CXTCustOptions CXTPopupTearOffWnd
CXTAccelManager CXTCustomizeSheet CXTPopupColorTearOff
CXTCBarDialog CXTDockBar CXTPopupToolbarTearOff
CXTCommandsListBox CXTDockColorSelector CXTPreviewView
CXTItemData CXTDockContext CXTSplitterDock
CXTCoolMenu CXTDockWindow CXTSplitterRowDock
CXTMenu CXTFrameImpl CXTToolBar
CXTCustomToolBar CXTString CXTToolBarCtrl
CXTCustToolBarPage CXTMenuBarItem CXTPopupWndToolbar
CXTCustCommandsPage CXTMenuBar CXTToolBarPopupWndHook
CXTCustAccelerators CXTMiniDockFrameWnd CXTToolBarPopupWnd
CXTCustTools CXTNewToolbarDlg CXTToolsManager

開始

改變你的主框架的繼承關(guān)系
現(xiàn)在你的程序已經(jīng)不再涉及標(biāo)準(zhǔn)版本的東西了,我們可以開始遷移了?,F(xiàn)在你已經(jīng)
更新了你的StdAfx.h文件,在你的MainFrm.h文件中改變你的基類為CXTPMDIFrameWnd
(對MDI程序)和CXTPFrameWnd(對SDI程序):

class CMainFrame : public CXTPMDIFrameWnd
{
...
};
如果你重載了PreTranslateMessage請確保你調(diào)用了CXTPMDIFrameWnd基類,例如:
BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class

return CXTPMDIFrameWnd::PreTranslateMessage(pMsg);
}
另外,如果你重載了OnCmdMsg請確保你調(diào)用了CXTPMDIFrameWnd基類,例如:

BOOL CMainFrame::OnCmdMsg(UINT nID, int nCode,
void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
{
// TODO: Add your specialized code here and/or call the base class

return CXTPMDIFrameWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
}

Command bar的初始化

Command bar在使用之前必須進(jìn)行初始化,而且它們必須在所有的control bar對象(
比如你的statusbar)創(chuàng)建之后再被創(chuàng)建。這是你為command bar設(shè)置theme的好地方。
在標(biāo)準(zhǔn)版中你需要調(diào)用xtAfxData.bXPMode = true;設(shè)置theme為Office XP。在專業(yè)版中
對每個組件你有theme
managers。這允許你定義你自己的theme或者選用toolkit中已定義的theme。

這是一個如何初始化controlbar的例子:
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CMDIFrameWnd::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;

// 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
}

// Set Office 2003 Theme
CXTPPaintManager::SetTheme(xtpThemeOfficeXP);

return 0;
}
使用coolmenu請注意:
在應(yīng)用程序中不再有必要調(diào)用InstallCoolMenus初始化菜單的theme。
這由commandbar的theme manager來處理。

menubar的創(chuàng)建

你需要更改你的代碼使用pro版本的menubar。使用了標(biāo)準(zhǔn)版toolkit的程序參
考CMainFrame::OnCreate的CXTMenuBar對象。在這里m_wndMenuBar對象被創(chuàng)建,
允許停靠被調(diào)用使menubar可以??吭诔绦虻墓ぷ鲄^(qū)。在專業(yè)版中做法有些不同,
沒必要調(diào)用允許??苛耍纾?br>int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CMDIFrameWnd::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;

// 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_MDISAMTYPE);
if(pMenuBar == NULL)
{
TRACE0("Failed to create menu bar.\n");
return -1; // fail to create
}

// Remove the old menu bar code...
// if (!m_wndMenuBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
// | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
// !m_wndMenuBar.LoadMenuBar(IDR_MAINFRAME))
// {
// TRACE0("Failed to create menubar\n");
// return -1; // fail to create
// }

// m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY);
// EnableDocking(CBRS_ALIGN_ANY);
// DockControlBar(&m_wndMenuBar);

return 0;
}

toolbar的創(chuàng)建

你需要更改你的代碼去使用pro版本的toolbar。相對于menubar,toolbar對象通常
在CMainFrame::OnCreate中創(chuàng)建,而且調(diào)用允許??渴箃oolbar??康匠绦虻墓ぷ鲄^(qū)。
Toolbar采用和menubar使用toolbar資源相似的創(chuàng)建方式,例如:

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CMDIFrameWnd::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;

// 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_MDISAMTYPE);
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;
}

// Remove the old tool bar code...
// if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
// | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
// !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
// {
// TRACE0("Failed to create toolbar\n");
// return -1; // fail to create
// }
// m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
// EnableDocking(CBRS_ALIGN_ANY);
// DockControlBar(&m_wndToolBar);

return 0;
}
本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊舉報。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
VC++6.0去掉單文檔中的菜單,工具欄,狀態(tài)欄
XTToolkitPro使用
打造完美的DialogBar(轉(zhuǎn)貼)
初識MFC框架
MFC框體添加菜單欄工具欄狀態(tài)欄
孫鑫VC視頻教程筆記之第九課“程序外觀修改及工具欄狀態(tài)欄編程”
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服