Click here to Skip to main content
15,897,334 members
Articles / Multimedia / GDI+

A Simple Pie Chart Control

Rate me:
Please Sign up or sign in to vote.
4.85/5 (28 votes)
5 Mar 2009CPOL4 min read 163.2K   6.6K   125  
An article written in to describe a simple pie chart control implemented to be used in MFC applications.
// PieChartDlg.h : header file
//

#pragma once
#include "afxwin.h"
#include "afxcmn.h"
#include "PieChartWnd.h"
// CPieChartDlg dialog
class CPieChartDlg : public CDialog
{
// Construction
public:
	CPieChartDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	enum { IDD = IDD_PIECHART_DIALOG };

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

	CPieChartWnd m_pieChart;
// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	DECLARE_MESSAGE_MAP()
public:
	double m_Value;
public:
	CString m_Item;
public:
	CString m_Label;
public:
	CString m_LabelUpd;
public:
	double m_ValueUpd;
public:
	CComboBox m_GrLight;
public:
	CComboBox m_GrDark;
public:
	CSliderCtrl m_SliderGrLight;
public:
	CSliderCtrl m_SliderGrDark;
public:
	CSliderCtrl m_SliderStAngle;
public:
	CSliderCtrl m_SliderIncAngle;
public:
	CComboBox m_ClrPicker;
public:
	CComboBox m_FntPicker;
public:
	CEdit m_Title;
public:
	CComboBox m_Styles;
public:
	CComboBox m_Sort;
	COLORREF m_ItemColor;
public:
	afx_msg void OnBnClickedColoritem();
public:
	afx_msg void OnBnClickedAdd();
public:
	afx_msg void OnSize(UINT nType, int cx, int cy);
public:
	afx_msg void OnBnClickedUpdlabel();
public:
	afx_msg void OnBnClickedUpdvalue();
public:
	afx_msg void OnBnClickedUpdcolor();
public:
	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
public:
	afx_msg void OnBnClickedColorset();
public:
	afx_msg void OnBnClickedFontset();
public:
	afx_msg void OnBnClickedTitleset();
public:
	afx_msg void OnBnClickedSave();
public:
	CString m_TitleStr;
public:
	afx_msg void OnCbnSelchangeStyle();
public:
	afx_msg void OnCbnSelchangeSort();
public:
	float m_Height;
public:
	afx_msg void OnBnClickedHeightset();
public:
	afx_msg void OnBnClickedRemove();
public:
	void AddTestItems(void);
public:
	afx_msg void OnCbnSelchangeGrdark();
public:
	afx_msg void OnCbnSelchangeGrlight();
};

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
Student
Canada Canada
Prasad Perera is a software developer who's interested in parallel and distributed computing and graphics programming!

Currently he is following his masters in Concordia University, Montreal.

Comments and Discussions