📄 exam6_6view.cpp
字号:
// Exam6_6View.cpp : implementation of the CExam6_6View class
//
#include "stdafx.h"
#include "Exam6_6.h"
#include "Exam6_6Doc.h"
#include "Exam6_6View.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CExam6_6View
IMPLEMENT_DYNCREATE(CExam6_6View, CView)
BEGIN_MESSAGE_MAP(CExam6_6View, CView)
//{{AFX_MSG_MAP(CExam6_6View)
ON_WM_LBUTTONUP()
ON_WM_LBUTTONDOWN()
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()
/////////////////////////////////////////////////////////////////////////////
// CExam6_6View construction/destruction
CExam6_6View::CExam6_6View()
{
// TODO: add construction code here
m_Drag=0;
}
CExam6_6View::~CExam6_6View()
{
}
BOOL CExam6_6View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CExam6_6View drawing
void CExam6_6View::OnDraw(CDC* pDC)
{
CExam6_6Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CExam6_6View printing
BOOL CExam6_6View::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CExam6_6View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CExam6_6View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CExam6_6View diagnostics
#ifdef _DEBUG
void CExam6_6View::AssertValid() const
{
CView::AssertValid();
}
void CExam6_6View::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CExam6_6Doc* CExam6_6View::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CExam6_6Doc)));
return (CExam6_6Doc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CExam6_6View message handlers
void CExam6_6View::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if(m_Drag)
{
m_Drag=0;
ReleaseCapture();
ClipCursor(NULL);
}
CView::OnLButtonUp(nFlags, point);
}
void CExam6_6View::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
m_CurrentPoint=point;
m_OriginPoint=Point;
SetCapture();
m_Drag=1;
RECT rect;
GetClientRect(&rect);
ClientToScreen(&rect);
ClipCursor(&rect);
CView::OnLButtonDown(nFlags, point);
}
void CExam6_6View::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if(m_Drag)
{
CClientDC dc(this);
CPen myPen;
cPen *pOldPen;
myPen.CreatePen(PS_SOLID,((CExam6_6App *)AfxGetApp())->m_myPenWidth,((CExam6_6App *)AfxGetApp())->m_myPenColor);
dc.SetROP2(R2_NOTXORPEN);
pOldPen=dc.SelectObject(&myPen);
dc.MoveTo(m_OriginPoint);
dc.LineTo(m_CurrentPoint);
dc.MoveTo(m_OriginPoint);
dc.LineTo(point);
dc.SelectObject(pOldPen);
m_CurrentPoint=point;
}
CView::OnMouseMove(nFlags, point);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -