女生说对什么过敏:minidraw错在哪

来源:百度文库 编辑:高考问答 时间:2024/04/29 07:29:58
// MiniDrawView.cpp : implementation of the CMiniDrawView class
//

#include "stdafx.h"
#include "MiniDraw.h"

#include "MiniDrawDoc.h"
#include "MiniDrawView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

CMiniDrawView

IMPLEMENT_DYNCREATE(CMiniDrawView, CView)

BEGIN_MESSAGE_MAP(CMiniDrawView, CView)
//{{AFX_MSG_MAP(CMiniDrawView)
ON_WM_LBUTTONDOWN()
ON_WM_RBUTTONDOWN()
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()

CMiniDrawView construction/destruction

CMiniDrawView::CMiniDrawView()
{
// TODO: add construction code here
m_Dragging = 0;
m_HCross=AfxGetApp ()->LoadStandardCursor (IDC__CROSS);

}

CMiniDrawView::~CMiniDrawView()
{
}

BOOL CMiniDrawView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs

return CView::PreCreateWindow(cs);
}

CMiniDrawView drawing

void CMiniDrawView::OnDraw(CDC* pDC)
{
CMiniDrawDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}

CMiniDrawView diagnostics

#ifdef _DEBUG
void CMiniDrawView::AssertValid() const
{
CView::AssertValid();
}

void CMiniDrawView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}

CMiniDrawDoc* CMiniDrawView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMiniDrawDoc)));
return (CMiniDrawDoc*)m_pDocument;
}
#endif //_DEBUG

CMiniDrawView message handlers

void CMiniDrawView::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default

m_PointOrigin = point;
m_PointOld = point;
SetCapture ();
m_Dragging = 1;

RECT Rect;
GetClientRect (&Rect);
ClientToScreen (&Rect);
::ClipCursor (&Rect);

CView::OnLButtonDown(nFlags, point);
}

void CMiniDrawView::OnRButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default

CView::OnRButtonDown(nFlags, point);
}

void CMiniDrawView::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default

::SetCursor (m_HCross);
if (m_Dragging)
{ m_Dragging=0;
::ReleaseCapture ();
::ClipCursor (NULL);
CClientDC ClientDC (this);
ClientDC.SetROP2 (R2_NOT);
ClientDC.MoveTo (m_PointOrigin);
ClientDC.LineTo (m_PointOld);
ClientDC.SetROP2 (R2_COPYPEN);
ClientDC.MoveTo (m_PointOrigin);
ClientDC.LineTo (point);
}

CView::OnMouseMove (nFlags, point);