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

📄 oscilloscopedlg.h

📁 模拟了现实中的示波器
💻 H
字号:
// OscilloscopeDlg.h : header file
//
#include "CurveFrame.h"
#include "RoundButton.h"
#include "BitmapDialog.h"
#include "RotateButton.h"
#include "SwitchButton.h"

#if !defined(AFX_OSCILLOSCOPEDLG_H__85E4372B_AB2E_4384_BBB3_23EFEBBB1AA5__INCLUDED_)
#define AFX_OSCILLOSCOPEDLG_H__85E4372B_AB2E_4384_BBB3_23EFEBBB1AA5__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

/////////////////////////////////////////////////////////////////////////////
// COscilloscopeDlg dialog
void CreateWave(UINT signaltype,
				int firstPos, 
				int n, 
				double amp,
				double freqSignal, 
				double freqSample,
				double phase,
				double offset,
				double data[]);
void SineWave(int firstPos, 
			  int n, 
			  double amp,
			  double freqSignal, 
			  double freqSample,
			  double phase,
			  double offset,
			  double data[]);
void RandWave(int firstPos,
			  int n,
			  double amp,
			  double freqSignal,
			  double freqSample,
			  double phase,
			  double offset,
			  double data[]);
void SawtoothWave(int firstPos,
			  int n,
			  double amp,
			  double freqSignal,
			  double freqSample,
			  double phase,
			  double offset,
			  double data[]);
void TriangleWave(int firstPos,
			  int n,
			  double amp,
			  double freqSignal,
			  double freqSample,
			  double phase,
			  double offset,
			  double data[]);
void SquareWave(int firstPos,
			  int n,
			  double amp,
			  double freqSignal,
			  double freqSample,
			  double phase,
			  double offset,
			  double data[]);
class COscilloscopeDlg : public CBitmapDialog
{
// Construction
public:
	COscilloscopeDlg(CWnd* pParent = NULL);	// standard constructor

public:
	void DrawClient(CWnd* pWnd);
	BOOL	 m_bStart;		//显示波形的标志位
	COLORREF m_Color;		//存储颜色临时变量

	int m_nCurChannel;		//当前选中的通道,主要为设置通道用
	int m_nNumPerCircle[3];	//每个周期的采样点数
	int	m_nCurNumOfSample[3];//当前采样的点的起始位置
	BOOL m_bChannel[3];//每个通道的开启状态

	struct _Signal
	{
		UINT	SignalType;	//波形
		double	Frequency;	//信号频率
		double	Phase;		//相位
		double	Amplitude;	//振幅
		double	Offset;		//偏移
		double	Data[1024];	//离散数字
		int		Number;		//在离散数字中的有效数从0开始的个数,也就是显示器上每屏的采样点数
	}Signal[3];
	_Signal RetriveSignal[5][3];
	int nTimes;
	void SaveSignal(_Signal signal0, _Signal signal1, _Signal signal2);

	void SaveDlgItemRect(CDialog *pDlg, int firstItem, int lastItem);
	void ResizeDlgItem(CDialog *pDlg, int firstItem, int lastItem);
	CRect rcDlg;
	CRect rcItem[20];//	

// Dialog Data
	//{{AFX_DATA(COscilloscopeDlg)
	enum { IDD = IDD_OSCILLOSCOPE_DIALOG };
	CSwitchButton	m_btnSignalType;
	CSwitchButton	m_btnChannel;
	CScrollBar	m_ScrollBar;
	CRotateButton	m_btnFreqSample;
	CRotateButton	m_btnWidth;
	CRotateButton	m_btnPhase;
	CRotateButton	m_btnOffset;
	CRotateButton	m_btnAmplitude;
	CRotateButton	m_btnFreqSignal;
	CRoundButton	m_OkRndBtn;
	CRoundButton	m_StartRndBtn;
	CRoundButton	m_ChTwoRndBtn;
	CRoundButton	m_ChThreeRndBtn;
	CRoundButton	m_ChOneRndBtn;
	CCurveFrame	m_ctrlCurveFrame;
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(COscilloscopeDlg)
	public:
	virtual BOOL PreTranslateMessage(MSG* pMsg);
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	//{{AFX_MSG(COscilloscopeDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg void OnStart();
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnSelectcolor();
	afx_msg void OnSelchangeCmbChannel();
	afx_msg void OnSelchangeCmbSignaltype();
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnBtnFreqsignal();
	afx_msg void OnBtnAmplitude();
	afx_msg void OnBtnOffset();
	afx_msg void OnBtnPhase();
	afx_msg void OnBtnWidth();
	afx_msg void OnBtnFreqsample();
	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
	afx_msg void OnBtnChanel();
	afx_msg void OnBtnSignaltype();
	//}}AFX_MSG
	afx_msg void OnChannel(UINT nID);
	afx_msg UINT OnNcHitTest(CPoint point);
	afx_msg void OnNcPaint();
	DECLARE_MESSAGE_MAP()
};

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

#endif // !defined(AFX_OSCILLOSCOPEDLG_H__85E4372B_AB2E_4384_BBB3_23EFEBBB1AA5__INCLUDED_)

⌨️ 快捷键说明

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