📄 teechart.h
字号:
// CurveChart.h: interface for the CCurveChart class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_CURVECHART_H__C82183CA_00F3_42BD_88A6_8EE6D4327E1E__INCLUDED_)
#define AFX_CURVECHART_H__C82183CA_00F3_42BD_88A6_8EE6D4327E1E__INCLUDED_
#define CURVECHART_CLASSNAME _T("MFCCurveChart")
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#endif // !defined(AFX_CURVECHART_H__C82183CA_00F3_42BD_88A6_8EE6D4327E1E__INCLUDED_)
/////////////////////////////////////////////////////////////////////////////
// CCurveChart window
/*---------------------------------------------*/
class CChartData
{
private:
float aryNum[50];
float aryNum2[50];
char *aryInfo[50];
COLORREF aryColor[50];
int i;
char *title;
COLORREF LineColor;
public:
CChartData();
int AddData(float num,float num2,LPSTR lpInfo="");
int AddData(float num,LPSTR lpInfo="",COLORREF color=RGB(0,0,0));
int GetData(float *num,float *num2,int index);
LPSTR GetInfo(int index);
int GetCount();
void SetTitle(LPSTR lpTitle);
LPSTR GetTitle();
void SetColor(COLORREF color);
COLORREF GetColor();
};
/*-----------------------------------------------*/
class CCurveChart : public CWnd
{
// Construction
public:
CCurveChart();
// Attributes
public:
int NodesCount;
private:
CChartData* lpDataAry[10];
int CurveCount;
char *title;
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CCurveChart)
protected:
virtual void CalcWindowRect(LPRECT lpClientRect, UINT nAdjustType = adjustBorder);
//}}AFX_VIRTUAL
// Implementation
public:
CChartData * NewCurve();
void Clear();
void Refresh();
void SetTitle(LPSTR str);
LPSTR GetTitle();
int AddCurve(CChartData * lpChartData);
BOOL Create(const RECT& rect, CWnd* parent, UINT nID,
DWORD dwStyle = WS_CHILD | WS_BORDER | WS_TABSTOP | WS_VISIBLE);
virtual ~CCurveChart();
// Generated message map functions
protected:
CPaintDC *pDC;
//{{AFX_MSG(CCurveChart)
afx_msg void OnPaint();
afx_msg void OnEnable(BOOL bEnable);
afx_msg void OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
void DrawRect(LPCRECT rect,COLORREF color=RGB(0,0,0));
void DrawRect(int x,int y,int width,int height,COLORREF color=RGB(0,0,0));
void FillRect(LPCRECT rect,COLORREF color=RGB(0,0,0));
void FillRect(int x,int y,int width,int height,COLORREF color=RGB(0,0,0));
void DrawLine(int x,int y,int x2,int y2);
};
class CBarChart : public CWnd
{
// Construction
public:
CBarChart();
// Attributes
public:
int NodesCount;
private:
CChartData* lpDataAry[10];
int BarCount;
char *title;
float yMax,yMin;
int SectCount;
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CCurveChart)
protected:
virtual void CalcWindowRect(LPRECT lpClientRect, UINT nAdjustType = adjustBorder);
//}}AFX_VIRTUAL
// Implementation
public:
CChartData * NewBar();
void Clear();
void Refresh();
void SetTitle(LPSTR str);
LPSTR GetTitle();
int AddBar(CChartData * lpChartData);
void SetYMax(float num);
void SetYMin(float num);
void SetSectCount(int num);
//system
BOOL Create(const RECT& rect, CWnd* parent, UINT nID,
DWORD dwStyle = WS_CHILD | WS_BORDER | WS_TABSTOP | WS_VISIBLE);
virtual ~CBarChart();
// Generated message map functions
protected:
CPaintDC *pDC;
//{{AFX_MSG(CCurveChart)
afx_msg void OnPaint();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
void DrawRect(LPCRECT rect,COLORREF color=RGB(0,0,0));
void DrawRect(int x,int y,int width,int height,COLORREF color=RGB(0,0,0));
void FillRect(LPCRECT rect,COLORREF color=RGB(0,0,0));
void FillRect(int x,int y,int width,int height,COLORREF color=RGB(0,0,0));
void DrawLine(int x,int y,int x2,int y2);
void DrawBar(int x,int y,int width,int height,COLORREF color=RGB(125,125,125),int cx=10,int cy=10);
};
/////////////////////////////////////////////////////////////////////////////
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -