停靠栏 树形控件 CTreeCtrl

带选择框的树形控件:

http://www.codeproject.com/Articles/140828/A-Multi-selectable-Tree-Control-Supports-Transpare

 

#include "./UI/CoolTabCtrl.h"    
#include "./UI/scbarg.h"
#include "./UI/mytreectrl.h"

/*
***************************************************************************************************
created: 2012/02/15
created: 15:2:2012 14:10
file path: f:\CameraSetingApp-v2.1.0\CameraSettingApp
file base: UIManager
author: JiQiuBo

purpose: 对界面类进行管理
****************************************************************************************************
*/
class CUIManager
{
public:

CUIManager(void)
{
m_pMainFrame = NULL;
}

virtual ~CUIManager(void)
{}



public:
class CMainFrame* m_pMainFrame;

protected:
CMyTreeCtrl m_wndTree;
CCoolTabCtrl m_TabCtrl;
CCoolBar m_wndMyBar1;


public:

int AddTreeCtrl(void);
};
#include "MainFrm.h"

int CUIManager::AddTreeCtrl(void)
{
if( NULL == m_pMainFrame )
return false;


///////////////////////////////////////////////////////////////////////////////////
m_pMainFrame->EnableDocking(CBRS_ALIGN_ANY);
if (!m_wndMyBar1.Create(_T("我的控制条"), m_pMainFrame, CSize(230,260),TRUE,40123))
{
TRACE0("Failed to create mybar\n");
return -1;
}
m_wndMyBar1.SetBarStyle(m_wndMyBar1.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
m_wndMyBar1.EnableDocking(CBRS_ALIGN_ANY);
m_pMainFrame->DockControlBar(&m_wndMyBar1,AFX_IDW_DOCKBAR_LEFT);
//ShowControlBar(&m_wndMyBar1, TRUE, FALSE );//!m_wndMyBar1.IsVisible(), FALSE);

//Tab
m_TabCtrl.Create(TCS_DOWN|WS_CHILD|WS_VISIBLE,CRect(0,0,100,100),&m_wndMyBar1,125);

//Tree
#define IDC_MYTREECTRL 64204
if (!m_wndTree.Create(WS_CHILD|WS_VISIBLE|TVS_HASLINES|TVS_HASBUTTONS|TVS_LINESATROOT|TVS_SHOWSELALWAYS,\
CRect(0, 0, 0, 0), &m_TabCtrl, IDC_MYTREECTRL))
{
TRACE0("Failed to create instant bar child\n");
return -1;
}
m_wndTree.ModifyStyleEx(0, WS_EX_CLIENTEDGE);

///往树型控件添加内容
HTREEITEM hti = m_wndTree.InsertItem(_T("本地"));
m_wndTree.InsertItem(_T("其它"));
m_wndTree.InsertItem(_T("192.168.1.218"), hti);
m_wndTree.InsertItem(_T("192.168.1.219"), hti);


m_TabCtrl.AddPage(&m_wndTree,"相机",IDI_ICON10);
m_TabCtrl.SetActivePage( 0 );

return false;
}



posted @ 2012-02-14 16:08  jqb  阅读(390)  评论(0编辑  收藏  举报