Click here to Skip to main content
15,897,151 members
Articles / Desktop Programming / MFC

CStaticTreeCtrl - A CStatic derived custom Tree control

Rate me:
Please Sign up or sign in to vote.
4.95/5 (82 votes)
1 May 200617 min read 328.6K   13.3K   169  
Step-by-step creation of a custom Tree control from a CStatic control, implementing basic functionality, eye-candy (font, bitmap background, etc.), scrolling (bars and wheel), multiline (wrapping) text, and audio context menu.
// CustomTreeControlDlg.h : header file
//

#if !defined(AFX_CUSTOMTREECONTROLDLG_H__B6655738_67F7_4BD2_A663_45943F988A2A__INCLUDED_)
#define AFX_CUSTOMTREECONTROLDLG_H__B6655738_67F7_4BD2_A663_45943F988A2A__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "ResizableDialog.h"
#include "StaticTreeCtrl.h"

/////////////////////////////////////////////////////////////////////////////
// CCustomTreeControlDlg dialog

class CCustomTreeControlDlg : public CResizableDialog
{
// Construction
public:
	CCustomTreeControlDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	//{{AFX_DATA(CCustomTreeControlDlg)
	enum { IDD = IDD_CUSTOMTREECONTROL_DIALOG };
	CStaticTreeCtrl	m_ST_Tree;
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CCustomTreeControlDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	//{{AFX_MSG(CCustomTreeControlDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_CUSTOMTREECONTROLDLG_H__B6655738_67F7_4BD2_A663_45943F988A2A__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

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


Written By
Japan Japan
Louis Armstrong, Count Basie, Chick Corea, Miles Davis, Benny Goodman, Spyro Gyra, Dizzy Gillespie, Keith Jarrett, Leroy Jenkins, Yusef Lateef, Al Di Meola, Glenn Miller, McCoy Tyner, Cecil Taylor, John Coltrane, Duke Ellington, Bill Evans, Ella Fitzgerald, Jean-Luc Ponty, John McLaughlin, Fats Navarro, Tito Puente, Paul Whiteman, Sun Ra, Caravan, Joe Farrell, Paco de Lucia, Weather Report, Charles Mingus, Pat Metheny, Charlie Parker, Charlie Byrd, Mahavishnu Orchestra, Wynton Marsalis, Return to Forever, Julien Loureau, Thelonious Monk, Max Roach , Pharaoh Sanders, Albert Ayler, Ornette Coleman, Sidney Bechet,...

Comments and Discussions