Click here to Skip to main content
15,886,639 members
Articles / Desktop Programming / MFC

CRHTree - An Owner-drawn CTreeCtrl that has Open/Close and Checkboxes on the Right

Rate me:
Please Sign up or sign in to vote.
4.76/5 (10 votes)
22 Aug 2007CPOL8 min read 83.4K   4.2K   55  
An owner-drawn CTreeCtrl that has checkboxes and open/close controls aligned vertically on the right hand edge of the tree for easy viewing regardless of the horizontal scroll position.
// TreeDemoDlg.h : header file
//

#pragma once
#include "afxcmn.h"

#include "RHTree.h"

// CTreeDemoDlg dialog
class CTreeDemoDlg : public CDialog
{
// Construction
public:
	CTreeDemoDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	enum { IDD = IDD_TREEDEMO_DIALOG };
	CRHTree				m_ctrlTree;
//	CTreeCtrl			m_ctrlTree;
	CScrollBar			m_ScrollGripper;		// Actually a scrollbar, but it provides our resizing gripper
	CImageList			m_ILTree;

	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support


// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	virtual BOOL OnInitDialog();
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnSize(UINT nType, int cx, int cy);
};

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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United Kingdom United Kingdom
Started programming on a Commodore Vic 20(!), and later entered employment programming for the Mac back in the days of System 6. Soon the pull of the Dark Side became too strong and I switched to Windows (Win 3.1) and have been coding for Windows ever since.

I'm now lead programmer for a small software house in Glasgow, Scotland. Our main products include PTFB Pro, ColorCache, and LogMeister.

Comments and Discussions