Chinaunix首页 | 论坛 | 博客
  • 博客访问: 5833401
  • 博文数量: 671
  • 博客积分: 10010
  • 博客等级: 上将
  • 技术积分: 7310
  • 用 户 组: 普通用户
  • 注册时间: 2006-07-14 09:56
文章分类

全部博文(671)

文章存档

2011年(1)

2010年(2)

2009年(24)

2008年(271)

2007年(319)

2006年(54)

我的朋友

分类: C/C++

2008-09-14 20:10:37

Sample Image - pie_chart_ctrl.gif

Introduction

This control class CPieChartCtrl is derived from CWnd. The purpose is to create a simple 2D pie chart in a dialog. The code is created and compiled with Visual C++ 5.0 SP3 under Windows 98.

How to use

  1. Use the MS Visual C++ dialog editor to place a custom control on the dialog, and enter "PIE_CHART_CTRL" as the Class name.

  2. Add a CPieChartCtrl class member in the header file
    #include "PieChartCtrl.h"
    ...
    CPieChartCtrl m_wndChart;
  3. Subclass the class member with the control in InitDialog()
    m_wndChart.SubclassDlgItem(IDC_PIECHART1, this); //IDC_PIECHART1 is the control ID
  4. Use these functions to edit to chart
    // SetTitle(CString) - Set the chart title text
    m_wndChart.SetTitle("Chart Title");
    
    // Reset() - Reset the chart and delete all pieces
    m_wndChart.Reset();
    
    // AddPiece(COLORREF colorBack, COLORREF colorText, 
    //            int nAngle, int strInfo = "");
    // Add one piece into the chart
    m_wndChart.AddPiece(colorBack, colorText, nAngle, strInfo);

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

阅读(788) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~