Click here to Skip to main content
11,717,570 members (80,765 online)
Click here to Skip to main content

A Tree List Control

, 19 Sep 2002 563.4K 18K 160
Rate this:
Please Sign up or sign in to vote.
A Tree List Control
<!-- Add the rest of your HTML here -->


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

Snapshot 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

Web Developer
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

You may also be interested in...

Comments and Discussions

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 
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
Member 75250315-Sep-11 23:56
memberMember 75250315-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 
Hello Dear Developers! Hello TigerX!

TurboDLL Controls is a great software component - well used in a lot of my toolssince years.

Now we make first experiences with windows 7. We see a strange visual effect during drag & drop operation.
During mouse movement a middle-large GREY and TRANSPARENT rectangle is around the mouse. I found that the layered windows did cause the effect.

If I exclude (comment out) in CTLCDragWnd::OnPaintBMP the following code sequence
g_lpfnUpdateLayeredWindow (
GetSafeHwnd(), pPDC -> GetSafeHdc(), &rcWindow.TopLeft(), &CSize( rcWindow.Width(), rcWindow.Height() ),
m_dcMem.GetSafeHdc(), &CPoint( 0, 0 ),
0x00, &bf, ULW_ALPHA);
g_lpfnSetLayeredWindowAttributes( GetSafeHwnd(), 0x000000, 160, ULW_ALPHA );
the grey rectangle disappear.


Thank you very mach! Every help is welcome.

With kind regards

Marko Winter
Questionhow to add combobox items Pin
Sakhalean3-Aug-10 21:34
memberSakhalean3-Aug-10 21:34 

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

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

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150901.1 | Last Updated 20 Sep 2002
Article Copyright 2002 by TigerX
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid