📄 ex4_3view.cpp
字号:
// Ex4_3View.cpp : implementation of the CEx4_3View class
//
#include "stdafx.h"
#include "Ex4_3.h"
#include "Ex4_3Doc.h"
#include "Ex4_3View.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CEx4_3View
IMPLEMENT_DYNCREATE(CEx4_3View, CView)
BEGIN_MESSAGE_MAP(CEx4_3View, CView)
//{{AFX_MSG_MAP(CEx4_3View)
ON_COMMAND(ID_DRAW_ENABLE, OnDrawEnable)
ON_COMMAND(ID_DRAW_DISABLE, OnDrawDisable)
ON_UPDATE_COMMAND_UI(ID_DRAW_RECT, OnUpdateDrawRect)
ON_UPDATE_COMMAND_UI(ID_DRAW_CIRCLE, OnUpdateDrawCircle)
ON_UPDATE_COMMAND_UI(ID_DRAW_ENABLE, OnUpdateDrawEnable)
ON_UPDATE_COMMAND_UI(ID_DRAW_DISABLE, OnUpdateDrawDisable)
ON_COMMAND(ID_DRAW_RECT, OnDrawRect)
ON_COMMAND(ID_DRAW_CIRCLE, OnDrawCircle)
//}}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()
/////////////////////////////////////////////////////////////////////////////
// CEx4_3View construction/destruction
CEx4_3View::CEx4_3View()
{
// TODO: add construction code here
m_Enable=true;
m_Shape=true;
}
CEx4_3View::~CEx4_3View()
{
}
BOOL CEx4_3View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CEx4_3View drawing
void CEx4_3View::OnDraw(CDC* pDC)
{
CEx4_3Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CEx4_3View printing
BOOL CEx4_3View::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CEx4_3View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CEx4_3View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CEx4_3View diagnostics
#ifdef _DEBUG
void CEx4_3View::AssertValid() const
{
CView::AssertValid();
}
void CEx4_3View::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CEx4_3Doc* CEx4_3View::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CEx4_3Doc)));
return (CEx4_3Doc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CEx4_3View message handlers
void CEx4_3View::OnDrawEnable()
{
// TODO: Add your command handler code here
m_Enable=true;
}
void CEx4_3View::OnDrawDisable()
{
// TODO: Add your command handler code here
m_Enable=false;
}
void CEx4_3View::OnUpdateDrawRect(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable (m_Enable);
pCmdUI->SetCheck (m_Shape?true:false);
}
void CEx4_3View::OnUpdateDrawCircle(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable (m_Enable);
pCmdUI->SetCheck (m_Shape?false:true);
}
void CEx4_3View::OnUpdateDrawEnable(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->SetCheck (m_Enable?true:false);
}
void CEx4_3View::OnUpdateDrawDisable(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->SetCheck (m_Enable?false:true);
}
void CEx4_3View::OnDrawRect()
{
// TODO: Add your command handler code here
m_Shape=true;
}
void CEx4_3View::OnDrawCircle()
{
// TODO: Add your command handler code here
m_Shape=false;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -