这是什么毛病? (加急!)
我编了一个绘制直线的vc程序,在编译时出现下列问题:
Deleting intermediate files and output files for project 'MiniDraw - Win32 Debug'.
--------------------Configuration: MiniDraw - Win32 Debug--------------------
Compiling resources...
Compiling...
StdAfx.cpp
Compiling...
MiniDraw.cpp
MainFrm.cpp
MiniDrawDoc.cpp
MiniDrawView.cpp
C:\My Documents\MiniDraw\MiniDrawView.cpp(124) : error C2601: 'OnLButtonUp' : local function definitions are illegal
C:\My Documents\MiniDraw\MiniDrawView.cpp(148) : fatal error C1004: unexpected end of file found
Generating Code...
Error executing cl.exe.
MiniDraw.exe - 2 error(s), 0 warning(s)
//*******************************************************************
MiniDrawView.cpp的代码如下:
MiniDrawView.cpp的代码如下:
// 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_MOUSEMOVE()
ON_WM_LBUTTONUP()
//}}AFX_MSG_MAP
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
m_ClassName=AfxRegisterWndClass
(CS_HREDRAW | CS_VREDRAW,
0,
(HBRUSH)::GetStockObject(WHITE_BRUSH),
0);
cs.lpszClass=m_ClassName;
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::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
::SetCursor(m_HCross);
if(m_Dragging)
{
CClientDC ClientDC(this);
ClientDC.SetROP2(R2_NOT);
ClientDC.MoveTo(m_PointOrigin);
ClientDC.LineTo(m_PointOld);
ClientDC.MoveTo(m_PointOrigin);
ClientDC.LineTo(point);
m_PointOld=point;
CView::OnMouseMove(nFlags, point);
}
void CMiniDrawView::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
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_COPYEN);
ClientDC.MoveTo(m_pointOrigin);
ClientDC.LineTo(point);
}
CView::OnLButtonUp(nFlags, point);
}