BOOL CStroke::DrawStroke(CDC* pDC)
{
Cpen penStroke;
if(!penStroke.CreatePen(PS_SOLID,m_nPenWidth,RGB(0,0,0)))
return FALSE;
CPen* pOldPen=pDC->SelectObject(&penStroke);
pDC->MoveTo(m_pointArray[0]);
for (int i=1;i<m_pointArray.GetSize();i++)
{
pDC->LineTo(m_pointArray[i]);
}
pDC->SelectObject(pOldPen);
return TRUE;
}
     void CDrawView::OnLButtonDown(UINT nFlags, CPoint point) 
{
// TODO: Add your message handler code here and/or call default
    //Pressing the mouse button in the view window starts a new stroke
//CScrollView changes the viewport orign and mapping mode.
//It's necessary to convert the point from device coordinates
OnPrepareDC(&dc);//set up mapping mode and viewport orign
dc.DPtoLP(&point);
CPen* pOldPen=dc.SelectObject(pDC->GetCurrentPen());
dc.MoveTo(m_ptPrev);
dc.LineTo(point);
dc.SelectObject(pOldPen);
m_pStrokeCur->FinishStroke();
//Tell the other views that this stroke has been added
//so that they can invalidate this stroke's area in their
//client area.
pDoc->UpdateAllViews(this,0L,m_pStrokeCur);
ReleaseCapture();//Release the mouse capture established at 
//the beginning of the mouse drag.
return;    
}
void CDrawView::OnLButtonUp(UINT nFlags, CPoint point) 
{
// TODO: Add your message handler code here and/or call default //Mouse button up is interesting in the draw application
//only if the user is currently drawing a new stroke by dragging
//the captured mouse.
if(GetCapture()!=this)
return;//If this window(view) didn't capture the mouse,
//then the user isn't drawing in this window.
CDrawDoc* pDoc=GetDocument();
CClientDC dc(this);
//CScrollView changes the viewport origin and mapping mode.
//It's necessary to convert the point from device coordinates
//to logical coordinates,such as are stored in the document.
return;//If this window(view) didn't capture the mouse,
//then the user isn't drawing in the window.
CClientDC dc(this);
//CScrollView changes the viewport origin and mapping mode .
//It's necesssary to convert the point from device coordinates
//to logical coordinates,such as are stored in the document.
OnPrepareDC(&dc);
dc.DPtoLP(&point);
m_pStrokeCur->m_pointArray.Add(point);
//Draw a line from the previous detected point in the mouse
//drag to the current point
CPen* pOldPen=dc.SelectObject(GetDocument()->GetCurrentPen());
dc.MoveTo(m_ptPrev);
dc.LineTo(point);
dc.SelectObject(pOldPen);
m_ptPrev=point;
return;
}void CDrawView::OnMouseMove(UINT nFlags, CPoint point) 
{
// TODO: Add your message handler code here and/or call default
//Mouse movement is interesting in the Scribble application
//only if the user is currently drawing a new stroke by dragging
//the captured mouse.
if(GetCapture()!=this)
//to logical coordinates,such as are stored in the document.
CClientDC dc(this);
OnPrepareDC(&dc);
dc.DPtoLP(&point);
m_pStrokeCur=GetDocument()->NewStroke();
//Add first point to the new stroke
m_pStrokeCur->m_pointArray.Add(point);
SetCapture();//Capture the mouse until button up.
m_ptPrev=point;//Serves as the MoveTo() anchor point for the
//LoneTo() the next point,as the user drags the 
//mouse.
return;
G:\Draw\DrawView.cpp(200) : error C2601: 'DrawStroke' : local function definitions are illegal
G:\Draw\DrawView.cpp(216) : error C2601: 'OnLButtonDown' : local function definitions are illegal
G:\Draw\DrawView.cpp(241) : error C2601: 'OnLButtonUp' : local function definitions are illegal
G:\Draw\DrawView.cpp(277) : error C2601: 'OnMouseMove' : local function definitions are illegal
G:\Draw\DrawView.cpp(298) : fatal error C1004: unexpected end of file found
请问各位高手这是怎么回事?
请问各位

解决方案 »

  1.   

    不用想,肯定是前面某个地方少了个大括号。是VC6吧?全选后按alt+f8让代码自动对齐,应该可以找出括号在哪里少了。
      

  2.   


    在projects->Setting->C/C++ ->Precompiled Header
    然后在"files"中选中这个cpp文件
     最后选择Not Using precompiled headers试试也许有用!
      

  3.   

    全选后按alt+f8让代码自动对齐原来VC可以这样使!
      

  4.   

    不是吧,连这都不知道?
    还可以把光标定位在一个花括号的里面,按ctrl+],光标就会自动跳转到这个花括号对应的另一个括号那里去。或者安装一个VisualAssist6,把光标定位在花括号内部,两个括号就会自动变色了。
    三种方法,我不信楼主还找不出究竟少了哪个括号,呵呵
      

  5.   

    建议去下一个assist x就不会发生这种事情了,嗬嗬!
      

  6.   

    DrawView.obj : error LNK2001: unresolved external symbol "protected: void __thiscall CDrawView::OnRButtonDown(unsigned int,class CPoint)" (?OnRButtonDown@CDrawView@@IAEXIVCPoint@@@Z)
    DrawView.obj : error LNK2001: unresolved external symbol "public: static struct CRuntimeClass  CStroke::classCStroke" (?classCStroke@CStroke@@2UCRuntimeClass@@A)
    Debug/Draw.exe : fatal error LNK1120: 2 unresolved externals
    Error executing link.exe.感谢楼上的各位,问题已经解决,可是编译后又出现如下错误,哈!!
    不明白啊!!!
      

  7.   

    DrawView.obj : error LNK2001: unresolved external symbol "public: static struct CRuntimeClass  CStroke::classCStroke" (?classCStroke@CStroke@@2UCRuntimeClass@@A)
    Debug/Draw.exe : fatal error LNK1120: 1 unresolved externalswhy