Visual C++ 时尚编程百例013(CRect类)

CRect类
在头文件中添加CRect r;
#define RED RGB(255,0,0)
#define GREEN RGB(0,255,0)
#define BLUE RGB(0,0,255)
#define BLACK RGB(0,0,0)
在源文件中修改OnDraw()
GetClientRect(r);
if(r.right>750&&r.right<1000||r.bottom>750&&r.bottom<1000)
 pDC->FillSolidRect(r,RED);
else if(r.right>500&&r.right<750||r.bottom>500&&r.bottom<750)
 pDC->FillSolidRect(r,GREEN);
else if(r.right<500||r.bottom<500)
 pDC->FillSolidRect(r,BLUE);
else
 pDC->FillSolidRect(r,BLACK);

错误 1 error C2143: 语法错误 : 缺少“)”(在“;”的前面)
#define RED RGB(255,0,0)
#define GREEN RGB(0,255,0)
这里如果后面加分号就会提示错误。小细节。
参考超前引用:
http://www.vckbase.com/bbs/prime/viewprime.asp?id=431
http://blog.vckbase.com/arong/archive/2004/05/28/294.aspx

posted @ 2011-03-09 09:55  大气象  阅读(1253)  评论(0编辑  收藏  举报
http://www.tianqiweiqi.com