Click here to Skip to main content
15,896,606 members
Articles / Desktop Programming / MFC

CRadioListBox: A ListBox with Radio Buttons (MFC version)

Rate me:
Please Sign up or sign in to vote.
4.79/5 (16 votes)
22 Dec 2007CPOL2 min read 133.1K   4.3K   54  
How to implement an owner-drawn ListBox with radio buttons instead of standard selection highlight
#if !defined(AFX_RADIOLISTBOX_H__E853DB3F_FF3C_4DAB_A4AB_1E300E7CC15D__INCLUDED_)
#define AFX_RADIOLISTBOX_H__E853DB3F_FF3C_4DAB_A4AB_1E300E7CC15D__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// RadioListBox.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// CRadioListBox window

class CRadioListBox : public CListBox
{
// Construction
public:
	CRadioListBox();

// Attributes
public:
  
// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CRadioListBox)
	public:
	virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CRadioListBox();

	// Generated message map functions
protected:
	//{{AFX_MSG(CRadioListBox)
	afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
	//}}AFX_MSG

	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

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

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


Written By
Architect
Peru Peru


Computer Electronics professional, Software Architect and senior Windows C++ and C# developer with experience in many other programming languages, platforms and application areas including communications, simulation systems, PACS/DICOM (radiology), GIS, 3D graphics and HTML5-based web applications.
Currently intensively working with Visual Studio and TFS.

Comments and Discussions