⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 curveframe.h

📁 模拟了现实中的示波器
💻 H
字号:
#if !defined(AFX_CURVEFRAME_H__9322550A_1652_4279_AD00_281C25BC12FE__INCLUDED_)
#define AFX_CURVEFRAME_H__9322550A_1652_4279_AD00_281C25BC12FE__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// CurveFrame.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// CCurveFrame window

class CCurveFrame : public CStatic
{
// Construction
public:
	CCurveFrame();

// Attributes
public:
	//设置
	void SetCurvePos(LPCRECT lpRect);//设置绘图区的位置,以及大小
	void SetCurveChannel(
		BOOL bOpenFirstChannel=TRUE,
		BOOL bOpenSecondChannel=TRUE,
		BOOL bOpenThirdChannel=TRUE);//设置三个通道开启状态
	void ApplyModify();

	void GetCurveWidth(UINT &width, int index);
	void GetCurveColor(COLORREF &color, int index);
	void SetCurveWidth(int width, int index);
	void SetCurveColor(COLORREF color, int index);
	
	//绘图
	void DrawCurve(double data1[1024], int num1,
		   		   double data2[1024], int num2,
				   double data3[1024], int num3,
				   double FreqencySample);
private:
	void DrawBkGround(CDC *pDC, LPCRECT lpRect);//绘制绘图区背景
	void DrawBkGrid(CDC *pDC, LPCRECT lpRect, //绘制曲线背景客户区
					  COLORREF clrBkGround, 
					  COLORREF clrGridXCoord,
					  COLORREF clrGridLine, 
					  COLORREF clrGridBoldLine);
	void DrawCoordText(CDC *pDC, LPCRECT lpRect, LPCRECT lpRectOffset);//绘制坐标标识文字
	void DrawCurveDetail(CDC *pDC, 
						 LPCRECT lpRect, 
						 COLORREF clrCurve, 
						 UINT width,
						 double Data[1024], 
						 int Number,
						 double FreqencySample);
private:
	//尺寸
	CRect m_rectBkArea;		//绘图区的尺寸
	CRect m_rectClientArea;	//绘图区中的绘制曲线这部分客户区的尺寸
	CRect m_rectOffset;		//绘图客户区尺寸=绘图区尺寸-客户向内的偏移量(正数为向内偏移)
	
	//颜色
	COLORREF m_clrBkGround;		//客户区背景颜色
	COLORREF m_clrGridLine;		//细网格线颜色
	COLORREF m_clrGridBoldLine;	//粗网格线颜色
	COLORREF m_clrGridXCoord;	//X轴线颜色
	COLORREF m_clrCurve[3];		//曲线的颜色

	//布尔量
	BOOL	m_bChannelFlag[3];	//三条曲线是否绘制的布尔量
	UINT	m_nWidth[3];		//三条曲线各自的宽度

	CBitmap m_bmp;
	CBitmap m_bmpCur;
	CBitmap m_bmpClient;
	
	CBitmap *m_pBmpOld;
	CBitmap *m_pBmpOldCur;
	CBitmap *m_pBmpOldClient;

	CDC		m_memDC;			//包含有已经画好的背景以及空客户区的设备上下文
	CDC		m_memDCCur;			//绘制在m_memDC上的曲线,主要用来显示
	CDC		m_memDCClient;		//绘制曲线的客户区

	//刻度
	float	m_fVerScale;//纵坐标的最大刻度值
	UINT	m_nHorScale;//横坐标的最大值(单位为ms)
// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CCurveFrame)
	protected:
	virtual void PreSubclassWindow();
	//}}AFX_VIRTUAL

// Implementation
private:
	void DrawBlackBkGround(CDC *pDC, LPCRECT lpRect);
	void Init();
public:
	virtual ~CCurveFrame();

	// Generated message map functions
protected:
	//{{AFX_MSG(CCurveFrame)
	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_CURVEFRAME_H__9322550A_1652_4279_AD00_281C25BC12FE__INCLUDED_)

⌨️ 快捷键说明

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