www.pudn.com > 简单的绘工具.rar > MyPaintView.h


// MyPaintView.h : interface of the CMyPaintView class 
// 
///////////////////////////////////////////////////////////////////////////// 
 
#if !defined(AFX_MYPAINTVIEW_H__8EF25019_D416_4C0C_BE61_A273F75A865F__INCLUDED_) 
#define AFX_MYPAINTVIEW_H__8EF25019_D416_4C0C_BE61_A273F75A865F__INCLUDED_ 
 
#include "POSITION.H" 
#include "ENTITY.H" 
#include "COMMAND.H" 
 
#if _MSC_VER > 1000 
#pragma once 
#endif // _MSC_VER > 1000 
 
class CMyPaintView : public CScrollView 
{ 
protected: // create from serialization only 
	CMyPaintView(); 
	DECLARE_DYNCREATE(CMyPaintView) 
 
// Attributes 
public: 
	CMyPaintDoc* GetDocument(); 
 
	// 世界坐标与屏幕坐标的关系 
	double	m_dOrgX, m_dOrgY;	// 世界坐标的原点坐标 
	double	scale;				// 屏幕坐标到世界坐标的比例因子 
 
	class CCommand* m_pCmd;  
 
	int m_nPageWidth, m_nPageHeight;	// 
 
// Operations 
public: 
	// 世界坐标转换为屏幕坐标,输入:世界坐标pos, 输出:屏幕坐标screenPt 
	void WorldtoScreen(const Position& pos, CPoint& screenPt);  
	// 屏幕坐标转换为世界坐标,输入:屏幕坐标screenPt, 输出:世界坐标pos 
	void ScreentoWorld(const CPoint& screenPt, Position& pos); 
	// 得到屏幕坐标到世界坐标的比例因子 
	double GetScale(); 
 
// Overrides 
	// ClassWizard generated virtual function overrides 
	//{{AFX_VIRTUAL(CMyPaintView) 
	public: 
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view 
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs); 
	protected: 
	virtual void OnInitialUpdate(); // called first time after construct 
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo); 
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo); 
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo); 
	//}}AFX_VIRTUAL 
	afx_msg void OnCreateEntity(int m_nID); 
	afx_msg void OnUpdateCreateCommand(CCmdUI* pCmdUI); 
	afx_msg void OnModifyEntity(int m_nID); 
	afx_msg void OnUpdateModifyCommand(CCmdUI* pCmdUI); 
 
// Implementation  
public: 
	virtual ~CMyPaintView(); 
#ifdef _DEBUG 
	virtual void AssertValid() const; 
	virtual void Dump(CDumpContext& dc) const; 
#endif 
 
protected: 
 
// Generated message map functions 
protected: 
	//{{AFX_MSG(CMyPaintView) 
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point); 
	afx_msg void OnMouseMove(UINT nFlags, CPoint point); 
	afx_msg void OnRButtonDown(UINT nFlags, CPoint point); 
	afx_msg void OnOptionPick(); 
	afx_msg void OnUpdateOptionPick(CCmdUI* pCmdUI); 
	//}}AFX_MSG 
	DECLARE_MESSAGE_MAP() 
}; 
 
#ifndef _DEBUG  // debug version in MyPaintView.cpp 
inline CMyPaintDoc* CMyPaintView::GetDocument() 
   { return (CMyPaintDoc*)m_pDocument; } 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
 
//{{AFX_INSERT_LOCATION}} 
// Microsoft Visual C++ will insert additional declarations immediately before the previous line. 
 
#endif // !defined(AFX_MYPAINTVIEW_H__8EF25019_D416_4C0C_BE61_A273F75A865F__INCLUDED_)