📄 drawdemoview.h
字号:
// DrawDemoView.h : interface of the CDrawDemoView class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_DRAWDEMOVIEW_H__501F6CED_BEC1_11D5_805E_5254AB274984__INCLUDED_)
#define AFX_DRAWDEMOVIEW_H__501F6CED_BEC1_11D5_805E_5254AB274984__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
//The CList Class defination
#include <afxtempl.h> //For CList
//The stack
#include <stack>
#define MAPWIDTH 50
#define MAPHEIGHT 30
#define TIMESTEP 1000
//My stack
using namespace std;
//typedef stack<CPoint> PointStack;
//typedef stack<int> intStack;
class CDrawDemoView : public CView
{
protected: // create from serialization only
CDrawDemoView();
DECLARE_DYNCREATE(CDrawDemoView)
// Attributes
public:
CDrawDemoDoc* GetDocument();
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDrawDemoView)
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:
COLORREF GetColor(int x, int y);
virtual ~CDrawDemoView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CDrawDemoView)
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnColorRed();
afx_msg void OnColorBlue();
afx_msg void OnColorGreen();
afx_msg void OnColorOther();
afx_msg void OnUpdateColorGreen(CCmdUI* pCmdUI);
afx_msg void OnUpdateColorOther(CCmdUI* pCmdUI);
afx_msg void OnUpdateColorRed(CCmdUI* pCmdUI);
afx_msg void OnUpdateColorBlue(CCmdUI* pCmdUI);
afx_msg void OnColorClear();
afx_msg void OnOpLine();
afx_msg void OnColorDark();
afx_msg void OnUpdateColorDark(CCmdUI* pCmdUI);
afx_msg void OnOpCircle();
afx_msg void OnUpdateOpCircle(CCmdUI* pCmdUI);
afx_msg void OnUpdateOpCurve(CCmdUI* pCmdUI);
afx_msg void OnOpFill();
afx_msg void OnUpdateOpFill(CCmdUI* pCmdUI);
afx_msg void OnUpdateOpLine(CCmdUI* pCmdUI);
afx_msg void OnOpNull();
afx_msg void OnUpdateOpNull(CCmdUI* pCmdUI);
afx_msg void OnOpRectangle();
afx_msg void OnUpdateOpRectangle(CCmdUI* pCmdUI);
afx_msg void OnTimer(UINT nIDEvent);
afx_msg void OnUpdateTimeStep(CCmdUI* pCmdUI);
afx_msg void OnUpdateTimeImme(CCmdUI* pCmdUI);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
void FillArea(int x, int y, COLORREF oldColor, COLORREF newColor);
CList <CPoint, CPoint&> pointList;
//PointStack pointStack;
CPoint tempPoint;
int m_nTotalPoint; //总共的点数
int m_nCurPos; //画到哪个点
CBitmap bmp;
CDC dcMemory;
void Rectangle(int x1, int y1, int x2, int y2);
void CirPot(int x0, int y0, int x, int y);
void BresCircle(int x0, int y0, int r);
void SetGrid(int x, int y, COLORREF color);
void Swap(int& a, int& b);
void BresenhamLine(int x1, int y1, int x2,int y2);
void DrawMap(CDC* pdc);
void FillGrid(CDC* pdc, int x, int y, COLORREF color);
void DrawGrid(CDC* pdc);
//COLORREF m_craGrids[MAPHEIGHT][MAPWIDTH];
COLORREF m_crCurColor;
RECT m_rtMapRect;
int m_nMapWidth;
int m_nMapHeight;
int m_nGridWidth;
int m_nStartX;
int m_nStartY;
int m_nEndX;
int m_nEndY;
int m_nStartGridX;
int m_nStartGridY;
int m_nEndGridX;
int m_nEndGridY;
BOOL m_bOpNull;
BOOL m_bOpLine;
BOOL m_bOpCurve;
BOOL m_bOpCircle;
BOOL m_bOpRectangle;
BOOL m_bOpFill;
int m_bColorDark;
int m_bColorRed;
int m_bColorGreen;
int m_bColorBlue;
int m_bColorOther;
BOOL m_bIfStep;
BOOL m_bStepEnd;
BOOL m_bSelecting;
BOOL m_bDrawing;
CBrush m_curBrush;
CPen m_curPen;
HCURSOR m_csArrow;
HCURSOR m_csCross;
};
#ifndef _DEBUG // debug version in DrawDemoView.cpp
inline CDrawDemoDoc* CDrawDemoView::GetDocument()
{ return (CDrawDemoDoc*)m_pDocument; }
#endif
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DRAWDEMOVIEW_H__501F6CED_BEC1_11D5_805E_5254AB274984__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -