这是什么毛病? (加急!)

fly123456 2003-03-15 10:39:42
我编了一个绘制直线的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);
}






...全文
39 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
jack_wq 2003-03-15
  • 打赏
  • 举报
回复
//*******************************************************************
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);
}
少了一个括弧

16,472

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧