Click here to Skip to main content
15,399,444 members
Articles / Desktop Programming / MFC
Posted 19 Sep 2002


170 bookmarked

A Tree List Control

Rate me:
Please Sign up or sign in to vote.
4.87/5 (82 votes)
19 Sep 2002
A Tree List Control


This is a class derived from CWnd class. It's a tree control with a list.


Below are some of the many features that CTreeListCtrl has:

  • Compatible with CTreeCtrl & CListCtrl
  • Header drag & drop
  • Drag & drop between CTreeListCtrl
  • Transparent drag window with Alpha blend
  • Double colors of list
  • Background image
  • Check box support
  • Lock box support
  • Embedded modified controls
  • No more in future

Snapshot 1

Image 1

Snapshot 2

Image 2

How to Use It

Add this string into stdafx.h:

#include "..\\TurboDLL\\xTurboDll.h"

Define Your Controls

class CMyTreeListCtrl : public CTreeListCtrl  
  virtual ~CMyTreeListCtrl();

  afx_msg void OnExpanding(NMHDR* pNMHDR, LRESULT* pResult);
  afx_msg void OnExpanded(NMHDR* pNMHDR, LRESULT* pResult);
  afx_msg void OnUpdating(NMHDR* pNMHDR, LRESULT* pResult);
  afx_msg void OnUpdated(NMHDR* pNMHDR, LRESULT* pResult);
  afx_msg void OnBeginDrag(NMHDR* pNMHDR, LRESULT* pResult);
  afx_msg void OnDragEnter(NMHDR* pNMHDR, LRESULT* pResult);
  afx_msg void OnDragLeave(NMHDR* pNMHDR, LRESULT* pResult);
  afx_msg void OnDragOver(NMHDR* pNMHDR, LRESULT* pResult);
  afx_msg void OnDrop(NMHDR* pNMHDR, LRESULT* pResult);


Use Your Controls

class CTurboDragDlg : public CDialog
// Construction
  CTurboDragDlg(CWnd* pParent = NULL);   // standard constructor
  CImageList  m_ImageList;
  CMyTreeListCtrl  m_tree1;
  CMyTreeListCtrl m_tree2;

  // TODO: Add extra initialization here
  m_ImageList.Create( IDB_BITMAP_TREE, 16, 4, 0xFF00FF );

  CRect rect;
  rect.DeflateRect( 5, 5, 5, 5 );

  CRect left;
  left = rect;
  left.right = ( rect.left + rect.right ) / 2;

  CRect right;
  right = rect;
  right.left = ( rect.left + rect.right ) / 2;

  m_tree1.Create( 0x50810000, left, this, 0 );
  m_tree2.Create( 0x50810000, right, this, 1 );

        // Add other initialize code here
        return TRUE;  // return TRUE unless you set the focus to a control
  // EXCEPTION: OCX Property Pages should return FALSE

Then use it freely.


This article has no explicit license attached to it, but may contain usage terms in the article text or the download files themselves. If in doubt, please contact the author via the discussion board below.

A list of licenses authors might use can be found here.


About the Author

Chief Technology Officer
China China
He is a Visual C++ developer, MCSE
He has been programming in C/C++ for 7 years, Visual C++ with MFC for 5 years and RDBMS: Oracle, MS SQL for 5 years

Comments and Discussions

Questioncouldn't open the file:"TurboDLLD.lib" Pin
Member 148380411-Jun-20 23:28
MemberMember 148380411-Jun-20 23:28 
GeneralMy vote of 5 Pin
Member 94178231-Sep-14 23:48
MemberMember 94178231-Sep-14 23:48 
QuestionDragging problem.... Pin
임건택27-Jun-14 16:37
Member임건택27-Jun-14 16:37 
AnswerRe: Dragging problem.... Pin
xjianguo15-Oct-15 20:48
Memberxjianguo15-Oct-15 20:48 
GeneralMy vote of 5 Pin
mxs8109-Aug-13 18:30
Membermxs8109-Aug-13 18:30 
QuestionHow to convert the project to "Use MFC in a Static Library"? Pin
thelastphoenix24-Oct-11 23:45
Memberthelastphoenix24-Oct-11 23:45 
GeneralMy vote of 5 Pin
C++Kernel5-Sep-11 23:56
MemberC++Kernel5-Sep-11 23:56 
GeneralUnable to Edit the columns. Pin
Mahadev HK4-May-11 15:41
MemberMahadev HK4-May-11 15:41 
GeneralRe: Unable to Edit the columns. Pin
Modal sun20-Sep-11 15:30
MemberModal sun20-Sep-11 15:30 
GeneralRe: Unable to Edit the columns. Pin
thelastphoenix16-Nov-11 15:42
Memberthelastphoenix16-Nov-11 15:42 
GeneralTuroboDll behaviour in Windows Vista or Windows 7 Pin
Member 115045326-Oct-10 22:38
MemberMember 115045326-Oct-10 22:38 
GeneralRe: TuroboDll behaviour in Windows Vista or Windows 7 Pin
mwnd1-Apr-16 7:17
Membermwnd1-Apr-16 7:17 
Questionhow to add combobox items Pin
Sakhalean3-Aug-10 21:34
MemberSakhalean3-Aug-10 21:34 
AnswerRe: how to add combobox items Pin
Member 115045326-Oct-10 22:54
MemberMember 115045326-Oct-10 22:54 
GeneralRe: how to add combobox items Pin
Sakhalean27-Oct-10 17:42
MemberSakhalean27-Oct-10 17:42 
GeneralRe: how to add combobox items Pin
dd_dzs10-Apr-11 22:05
Memberdd_dzs10-Apr-11 22:05 
QuestionThe tree list control Pin
YeMeGe20-May-10 11:24
MemberYeMeGe20-May-10 11:24 
QuestionHow to solve Bug using ComboBox Pin
uara8229-Oct-09 16:41
Memberuara8229-Oct-09 16:41 
General"A required resource was unavailable" Pin
Naryoril1-Sep-09 1:19
MemberNaryoril1-Sep-09 1:19 
Generalfind a bug Pin
7817537914-May-09 21:24
Member7817537914-May-09 21:24 
GeneralMultiline text inNode Pin
jatin dave20-Jan-09 21:48
Memberjatin dave20-Jan-09 21:48 
GeneralCrash in CancelControl() on 64 bit platforms. Pin
Member 431310519-Dec-08 2:15
MemberMember 431310519-Dec-08 2:15 
QuestionCrash in CancelModify - after ESCAPE key Pin
Member 115045312-Nov-08 23:30
MemberMember 115045312-Nov-08 23:30 
GeneralFind a text and highlight Pin
mohadeb14-Oct-08 3:22
Membermohadeb14-Oct-08 3:22 
Question跪求,老大这个怎么编译Release版本? Pin
tuhaitao9-Jun-08 19:07
Membertuhaitao9-Jun-08 19:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.