graphctrl.h

来自「wince下的画二维曲线的的一个程序」· C头文件 代码 · 共 94 行

H
94
字号
#if !defined(AFX_GRAPHCTRL_H__49A61F3B_12CB_4BCB_9D87_2B23CF23958C__INCLUDED_)
#define AFX_GRAPHCTRL_H__49A61F3B_12CB_4BCB_9D87_2B23CF23958C__INCLUDED_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
/////////////////////////////////////////////////////////////////////////////
// MECGraphCtrl window
class MECPoint: public CObject
{
public:
	double x;
	double y;
};
class MECGraphCtrl : public CWnd
{
// Construction
public:
	MECGraphCtrl();

// Attributes
public:
		MECPoint m_oPoints[MAX_PATH], m_oNewPoint,m_dPoints[MAX_PATH];
		int m_nLastIndexPoint;

		COLORREF m_crBackColor;        // background color
		COLORREF m_crGridColor;        // grid color
		COLORREF m_crPlotColor;        // data color  

		int m_nClientHeight;
        int m_nClientWidth;
	    int m_nPlotHeight;
	    int m_nPlotWidth;

		double m_dLowerLimit, m_dXLower;        // lower bounds
		double m_dUpperLimit, m_dXUpper;        // upper bounds
		double m_dRange, m_XRange;
		double m_dVerticalFactor, m_dHorizontalFactor;
  
		CRect  m_rectClient;
		CRect  m_rectPlot;
		CPen   m_penPlot;
		CBrush m_brushBack;

		CDC     m_dcGrid;
		CDC     m_dcPlot;
		CBitmap *m_pbitmapOldGrid;
		CBitmap *m_pbitmapOldPlot;
		CBitmap m_bitmapGrid;
		CBitmap m_bitmapPlot;

		int m_nYDecimals, m_nXDecimals;
	
		CString m_strXUnitsString;
		CString m_strYUnitsString;
// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(MECGraphCtrl)
	virtual BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID=NULL);
	//}}AFX_VIRTUAL

// Implementation
public:
	void SetXRange(double dLower, double dUpper, int nDecimalPlaces);
	void InvalidateCtrl();
	void DrawPoints();
	void AppendPoint(double dPointX, double dPointY);
	void SetRange(double dLower, double dUpper, int nDecimalPlaces);
	void SetXUnits(CString string);
	void SetYUnits(CString string);
	void SetGridColor(COLORREF color);
	void SetPlotColor(COLORREF color);
	void SetBackgroundColor(COLORREF color);
	virtual ~MECGraphCtrl();

	// Generated message map functions
protected:
	//{{AFX_MSG(MECGraphCtrl)
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnPaint();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

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

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

#endif // !defined(AFX_GRAPHCTRL_H__49A61F3B_12CB_4BCB_9D87_2B23CF23958C__INCLUDED_)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?