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

📄 drawview.h

📁 文档和视 内容摘要: 1.通过文档类与用户交互 2.通过视类与用户交互 含有相关的课件和源码例子说明,适用于VC初学者
💻 H
字号:
// DrawView.h : interface of the CDrawView class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_DRAWVIEW_H__2196A8ED_C405_11D5_AAE6_FDC4E8AC2D60__INCLUDED_)
#define AFX_DRAWVIEW_H__2196A8ED_C405_11D5_AAE6_FDC4E8AC2D60__INCLUDED_

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

#define MAXDATANUMBER 300  // 曲线显示数据的个数
#define MAINWIDTH 600      // 主窗口宽度
#define MAINHEIGHT 200     // 主窗口高度

// 定义画笔颜色常量
#define BLACKPEN 0
#define REDPEN 1
#define GREENPEN 2
#define BLUEPEN 3
#define BLUEDOTPEN 4


class CDrawView : public CView
{
protected: // create from serialization only
	CDrawView();
	DECLARE_DYNCREATE(CDrawView)

private:
	int MainWindowLeft;  //主窗口左下角
	int MainWindowBottom;

	int winx;   // 屏幕右下角
	int winy;

	float Data[MAXDATANUMBER];  //存储数据的数组
	float max ;                 //最大允许值 
	float min;		            //最小允许值

	int Status;     //记录程序状态 0:未监测,
					//			   1:监测

	int timerGap;    // 处理一个数据的时间(毫秒)
	UINT	timerID; // 定时器编号

	CDC  *pBackDC;  // 用于内存画图的CDC类指针
    CBitmap  bmp;   // 内存位图
	CPen  pen[5];   // 画笔

	CFile dataFile; // 用于从文件中读取数据


// Attributes
public:
	CDrawDoc* GetDocument();

// Operations
public:
	void DrawCoordinate(CDC *pBackDC, int color, int left, int top, int right, int bottom);
	void WriteCoordinateX(CDC *pBackDC, int color, int left, int right, int bottom);
	void WriteCoordinateY(CDC *pBackDC, float max, float min, int color, int left, int bottom);
	void WriteMessage(CDC *pBackDC, int left, int bottom, int hight );
	void DrawGraph(CDC *pBackDC, int color, int right, int bottom);
	void DrawPicture();

	void ResetData();

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CDrawView)
	public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	protected:
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CDrawView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CDrawView)
	afx_msg void OnStart();
	afx_msg void OnStop();
	afx_msg void OnUpdateStop(CCmdUI* pCmdUI);
	afx_msg void OnUpdateStart(CCmdUI* pCmdUI);
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnTimer(UINT nIDEvent);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG  // debug version in DrawView.cpp
inline CDrawDoc* CDrawView::GetDocument()
   { return (CDrawDoc*)m_pDocument; }
#endif

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

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

#endif // !defined(AFX_DRAWVIEW_H__2196A8ED_C405_11D5_AAE6_FDC4E8AC2D60__INCLUDED_)

⌨️ 快捷键说明

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