Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
Tree2.cpp
Package: VC界面编程高级应用技术.rar [view]
Upload User: szcysw
Upload Date: 2013-03-11
Package Size: 6752k
Code Size: 2k
Category:
GUI Develop
Development Platform:
Visual C++
- // Tree2.cpp : implementation file
- //
- #include "stdafx.h"
- #include "DevDemo.h"
- #include "Tree2.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CTree2
- IMPLEMENT_DYNCREATE(CTree2, CTreeView)
- CTree2::CTree2()
- {
- }
- CTree2::~CTree2()
- {
- }
- BEGIN_MESSAGE_MAP(CTree2, CTreeView)
- //{{AFX_MSG_MAP(CTree2)
- // NOTE - the ClassWizard will add and remove mapping macros here.
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CTree2 drawing
- void CTree2::OnDraw(CDC* pDC)
- {
- CDocument* pDoc = GetDocument();
- // TODO: add draw code here
- }
- /////////////////////////////////////////////////////////////////////////////
- // CTree2 diagnostics
- #ifdef _DEBUG
- void CTree2::AssertValid() const
- {
- CTreeView::AssertValid();
- }
- void CTree2::Dump(CDumpContext& dc) const
- {
- CTreeView::Dump(dc);
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // CTree2 message handlers
- //修改标签窗口2的外观
- void CTree2::OnInitialUpdate()
- {
- CTreeView::OnInitialUpdate();
- CTreeCtrl& m_pTreeCtrl=GetTreeCtrl( );
- CString msg;
- //为目录树建立图像列表
- m_ImageList.Create (IDB_IL_CLASS, 16, 1, RGB(0,255,0));
- m_pTreeCtrl.SetImageList (&m_ImageList, TVSIL_NORMAL);
- CString strTreeItems[] = { _T("项目"), _T("类名"), _T("Globals") };
- //加入根节点
- HTREEITEM htItem = m_pTreeCtrl.InsertItem(strTreeItems[0]);
- m_pTreeCtrl.SetItemState( htItem, TVIS_BOLD, TVIS_BOLD );
- //加入子节点
- for( int i = 1; i < 8; i++ )
- {
- msg.Format("%d",i);
- m_pTreeCtrl.InsertItem (strTreeItems[1]+msg, 1, 1, htItem, TVI_LAST);
- }
- //加入子节点2
- m_pTreeCtrl.InsertItem (strTreeItems[2], 2, 3, htItem, TVI_LAST);
- //展开目录
- m_pTreeCtrl.Expand(htItem, TVE_EXPAND);
- }
- BOOL CTree2::PreCreateWindow(CREATESTRUCT& cs)
- {
- // TODO: Add your specialized code here and/or call the base class
- cs.style|=TVS_HASLINES|TVS_LINESATROOT;
- return CTreeView::PreCreateWindow(cs);
- }
- BOOL CTree2::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
- {
- // TODO: Add your specialized code here and/or call the base class
- return CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
- }