📄 vc07view.cpp
字号:
// VC07View.cpp : implementation of the CVC07View class
//
#include "stdafx.h"
#include "VC07.h"
#include "VC07Doc.h"
#include "VC07View.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CVC07View
IMPLEMENT_DYNCREATE(CVC07View, CView)
BEGIN_MESSAGE_MAP(CVC07View, CView)
//{{AFX_MSG_MAP(CVC07View)
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONUP()
ON_WM_MOUSEMOVE()
//}}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()
/////////////////////////////////////////////////////////////////////////////
// CVC07View construction/destruction
CVC07View::CVC07View()
{
// TODO: add construction code here
m_move=0;
m_hc=AfxGetApp()->LoadStandardCursor(IDC_CROSS);
}
CVC07View::~CVC07View()
{
}
BOOL CVC07View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CVC07View drawing
void CVC07View::OnDraw(CDC* pDC)
{
CVC07Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
int index;
index=pDoc->GetTotalEllipseRec();
while(index--)
pDoc->GetEllipseRec(index)->DrawEllipse(pDC);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CVC07View printing
BOOL CVC07View::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CVC07View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CVC07View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CVC07View diagnostics
#ifdef _DEBUG
void CVC07View::AssertValid() const
{
CView::AssertValid();
}
void CVC07View::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CVC07Doc* CVC07View::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CVC07Doc)));
return (CVC07Doc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CVC07View message handlers
void CVC07View::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
m_now=point;
m_begin=point;
m_move=1;
RECT rect;
GetClientRect(&rect);
ClientToScreen(&rect);
ClipCursor(&rect);
CView::OnLButtonDown(nFlags, point);
}
void CVC07View::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
m_move=0;
ClipCursor(NULL);
CVC07Doc *pDoc=GetDocument();
pDoc->AddEllipseRec(m_begin.x,m_begin.y,point.x,point.y);
CView::OnLButtonUp(nFlags, point);
}
void CVC07View::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
SetCursor(m_hc);
if(m_move)
{
CClientDC cdc(this);
cdc.SetROP2(R2_NOT);
cdc.Ellipse(m_begin.x,m_begin.y,m_now.x,m_now.y);
cdc.Ellipse(m_begin.x,m_begin.y,point.x,point.y);
m_now=point;
}
CView::OnMouseMove(nFlags, point);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -