viksoe.dk

Pie Chart control

Pie Chart control


This article was submitted .


The Pie Chart control is a subclassed STATIC Windows control, which paints a simple pie chart.

To use it, place a static control (label) on your dialog.
Add a member variable to your dialog implementation file...

CPieChart m_ctlPie
In the OnInitDialog() event handler, add the following lines:
LRESULT OnInitDialog(UINT /*uMsg*/, 
                     WPARAM /*wParam*/, 
                     LPARAM /*lParam*/, 
                     BOOL& /*bHandled*/)
{
  ...
  m_ctlPie.SubclassWindow(GetDlgItem(IDC_PIE1));
  m_ctlPie.SetPercent(42);
  ...
}

The control only splits the pie in two sections.
A later, more fancy and 3D, version will be developed shortly as soon as I get the time.

Source Code Dependencies

Microsoft Visual C++ 6.0
Microsoft WTL 3.0 Library

See Also

Shell Extension that uses the control

Download Files

DownloadSource Code (3 Kb)