📄 painterusepatternview.cpp
字号:
// PainterUsePatternView.cpp : implementation of the CPainterUsePatternView class
//
#include "stdafx.h"
#include "PainterUsePattern.h"
#include "MainFrm.h"
#include "PainterUsePatternDoc.h"
#include "PainterUsePatternView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPainterUsePatternView
IMPLEMENT_DYNCREATE(CPainterUsePatternView, CView)
BEGIN_MESSAGE_MAP(CPainterUsePatternView, CView)
//{{AFX_MSG_MAP(CPainterUsePatternView)
ON_WM_MOUSEMOVE()
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONUP()
ON_WM_RBUTTONDOWN()
ON_WM_RBUTTONUP()
ON_COMMAND(ID_SELECT_TOOL, OnSelectTool)
ON_COMMAND(ID_CIRCLE_TOOL, OnCircleTool)
ON_COMMAND(ID_ELLIPSE_TOOL, OnEllipseTool)
ON_COMMAND(ID_LINE_TOOL, OnLineTool)
ON_COMMAND(ID_POINT_TOOL, OnPointTool)
ON_COMMAND(ID_RECTANGLE_TOOL, OnRectangleTool)
ON_COMMAND(ID_PRESTEP, OnPrestep)
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPainterUsePatternView construction/destruction
CPainterUsePatternView::CPainterUsePatternView()
{
// TODO: add construction code here
}
CPainterUsePatternView::~CPainterUsePatternView()
{
}
BOOL CPainterUsePatternView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CPainterUsePatternView drawing
void CPainterUsePatternView::OnDraw(CDC* pDC)
{
CPainterUsePatternDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
m_paintor.Draw( pDC );
}
/////////////////////////////////////////////////////////////////////////////
// CPainterUsePatternView printing
BOOL CPainterUsePatternView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CPainterUsePatternView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CPainterUsePatternView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CPainterUsePatternView diagnostics
#ifdef _DEBUG
void CPainterUsePatternView::AssertValid() const
{
CView::AssertValid();
}
void CPainterUsePatternView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CPainterUsePatternDoc* CPainterUsePatternView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CPainterUsePatternDoc)));
return (CPainterUsePatternDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CPainterUsePatternView message handlers
void CPainterUsePatternView::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd();
pFrame->UpdateStatusBar( point , 0 , "NoTable is Opened");
CDC* pDC = GetDC();
m_paintor.MouseMove( point , pDC );
ReleaseDC( pDC );
CView::OnMouseMove(nFlags, point);
}
void CPainterUsePatternView::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CDC* pDC = GetDC();
m_paintor.LButtonDown( point , pDC );
ReleaseDC( pDC );
Invalidate();
CView::OnLButtonDown(nFlags, point);
}
void CPainterUsePatternView::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CDC* pDC = GetDC();
m_paintor.LButtonUp( point , pDC );
ReleaseDC( pDC );
Invalidate();
CView::OnLButtonUp(nFlags, point);
}
void CPainterUsePatternView::OnRButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CDC* pDC = GetDC();
m_paintor.RButtonDown( point , pDC );
ReleaseDC( pDC );
Invalidate();
CView::OnRButtonDown(nFlags, point);
}
void CPainterUsePatternView::OnRButtonUp(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CDC* pDC = GetDC();
m_paintor.RButtonUp( point , pDC );
ReleaseDC( pDC );
Invalidate();
CView::OnRButtonUp(nFlags, point);
}
void CPainterUsePatternView::OnSelectTool()
{
// TODO: Add your command handler code here
m_paintor.SetStatus( PS_SELECT );
//装载光标;
}
void CPainterUsePatternView::OnCircleTool()
{
// TODO: Add your command handler code here
m_paintor.SetStatus( PS_CIRCLE );
//装载光标;
}
void CPainterUsePatternView::OnEllipseTool()
{
// TODO: Add your command handler code here
}
void CPainterUsePatternView::OnLineTool()
{
// TODO: Add your command handler code here
m_paintor.SetStatus( PS_LINE );
//装载光标;
}
void CPainterUsePatternView::OnPointTool()
{
// TODO: Add your command handler code here
m_paintor.SetStatus( PS_POINT ) ;
//装载光标;
}
void CPainterUsePatternView::OnRectangleTool()
{
// TODO: Add your command handler code here
m_paintor.SetStatus( PS_RECT ) ;
}
void CPainterUsePatternView::OnPrestep()
{
// TODO: Add your command handler code here
CDC* pDC = GetDC();
m_paintor.PreStep( pDC );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -