利用Codejock创建TaskPanel(ToolBox) - 2

Toolbox也可以使用真彩色图标
步骤如下:
1)
将真彩色icon添加到vs2005工程中
2)
BOOL CMainFrame::CreateTaskPanel()
{
if (!m_wndTaskPanel.Create(WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_TABSTOP, CRect(0, 0, 0, 0), &m_wndSplitter, m_wndSplitter.IdFromRowCol(0, 0)))
return FALSE;

m_wndTaskPanel.SetOwner(this);

m_wndTaskPanel.GetImageManager()->SetIcon(IDI_ICON1, 0);
m_wndTaskPanel.GetImageManager()->SetIcon(IDI_ICON2, 1);
m_wndTaskPanel.GetImageManager()->SetIcon(IDI_ICON3, 2);

m_wndTaskPanel.SetBehaviour(xtpTaskPanelBehaviourToolbox);
m_wndTaskPanel.SetTheme(xtpTaskPanelThemeShortcutBarOffice2007);
m_wndTaskPanel.SetSelectItemOnFocus(TRUE);
m_wndTaskPanel.AllowDrag(TRUE);
m_wndTaskPanel.SetIconSize(CSize(32, 32));
m_wndTaskPanel.SetItemLayout(xtpTaskItemLayoutImagesWithTextBelow);

m_wndSplitter.SetColumnInfo(0, 210, 0);

return TRUE;
}



/////////////////////////////////////////////////////////////////////////
//CXTPTaskPanel也可以直接放到View中
/////////////////////////////////////////////////////////////////////////

步骤如下:
1)
新建一个SDI

2)
View.h中
CXTPTaskPanel m_wndTaskPanel;
CXTPTaskPanelGroup* CreateToolboxGroup(UINT nID);

3)
View.cpp中

void CToolBox2View::OnInitialUpdate()
{
    ... ...
    // TODO: Add your specialized code here and/or call the base class
    if (!m_wndTaskPanel.Create(WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_TABSTOP, 
        rc, this, 1231))
return ;
m_wndTaskPanel.SetOwner(this);

    m_wndTaskPanel.GetImageManager()->SetIcon(IDI_ICON1, 0);
    m_wndTaskPanel.GetImageManager()->SetIcon(IDI_ICON2, 1);
    m_wndTaskPanel.GetImageManager()->SetIcon(IDI_ICON3, 2);

m_wndTaskPanel.SetBehaviour(xtpTaskPanelBehaviourToolbox);
m_wndTaskPanel.SetTheme(xtpTaskPanelThemeShortcutBarOffice2007);
m_wndTaskPanel.SetSelectItemOnFocus(TRUE);
m_wndTaskPanel.AllowDrag(TRUE);
    m_wndTaskPanel.SetIconSize(CSize(32, 32));
    m_wndTaskPanel.SetItemLayout(xtpTaskItemLayoutImagesWithTextBelow);

///////////////////////////////////////////////////////////////////////
    m_wndTaskPanel.GetGroups()->Clear(FALSE);
CXTPTaskPanelGroup* pFolderPropertyPanes = CreateToolboxGroup(ID_TOOLBOXFOLDER_PROPERTYPANES);
CXTPTaskPanelGroup* pFolderData = CreateToolboxGroup(ID_TOOLBOXFOLDER_DATA);
pFolderData->AddLinkItem(ID_TOOLBOXITEM_DATASET                 ,1);
pFolderData->AddLinkItem(ID_TOOLBOXITEM_OLEDBDATAADAPTER        ,1);

CXTPTaskPanelGroup* pFolderComponents = CreateToolboxGroup(ID_TOOLBOXFOLDER_PROPERTYPANES);
pFolderComponents->AddLinkItem(ID_TOOLBOXITEM_DATASET     ,2);
pFolderComponents->AddLinkItem(ID_TOOLBOXITEM_OLEDBDATAADAPTER              ,1);

CreateToolboxGroup(ID_TOOLBOXFOLDER_GENERAL);
pFolderPropertyPanes->SetExpanded(TRUE);
}

CXTPTaskPanelGroup* CToolBox2View::CreateToolboxGroup(UINT nID)
{
CXTPTaskPanelGroup* pFolder = m_wndTaskPanel.AddGroup(nID);

CXTPTaskPanelGroupItem* pPointer = pFolder->AddLinkItem(ID_TOOLBOXITEM_POINTER, 0);
pPointer->SetItemSelected(TRUE);
pPointer->AllowDrag(FALSE);
pPointer->AllowDrop(FALSE);
pFolder->SetIconIndex(IDR_MAINFRAME);

return pFolder;
}

转载于:https://www.cnblogs.com/zkliuym/archive/2010/04/02/1703124.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值