标题:[求助]为什么我在本程序中用switch语句会出错
只看楼主
li202108
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2006-5-5
 问题点数:0 回复次数:0 
[求助]为什么我在本程序中用switch语句会出错

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 时出错.

搜索更多相关主题的帖子: switch Roman Times 
2006-05-05 10:33



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-61944-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.196708 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved