void CPathView::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CClientDC dc(this);
switch(m_choice)
{case 0:
CBrush newBrush,*pOldBrush;
newBrush.CreateSolidBrush(RGB(255,0,0));
pOldBrush=dc.SelectObject(&newBrush);
CPen newPen(PS_SOLID,1,RGB(255,0,0));
CPen* pOldPen=dc.SelectObject(&newPen);
POINT y;
y.x=point.x;
y.y=point.y;
y.x=(y.x/10)*10+5;
y.y=(y.y/10)*10+5;
dc.Rectangle(y.x-5,y.y-5,y.x+5,y.y+5);
dc.SelectObject(pOldBrush);
dc.SelectObject(pOldPen);
break;
case 1:
left_top_point=point;
break;
}
CView::OnLButtonDown(nFlags, point);
}
error C2360: initialization of 'pOldPen' is skipped by 'case' label
see declaration of 'pOldPen'
error C2360: initialization of 'newPen' is skipped by 'case' label
see declaration of 'newPen'
error C2360: initialization of 'newBrush' is skipped by 'case' label
see declaration of 'newBrush'
执行 cl.exe 时出错.