头文件:#include <afxwin.h> A CRect object can be passed as a function parameter wherever a RECT structure, LPCRECT, or LPRECT can be passed. 当需要 RECT*、LPCRECT、LPRECT 类型参数传参时,可以直接使用CRect。 因为重载操作符了 operator
在源文件中修改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...
在源文件中修改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...
nanyangzp 0 2883 Visual C++ 时尚编程百例013(CRect类) 2011-03-09 09:55 −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... ...
C++标准库之string类型 2019-12-10 00:46 − # stirng类型 ## 简介: > C++标准库提供的类型:string > 长度可变的字符串 > 操作简单 > ***仅为包含个人常用函数*** ## 头文件 string 类型与其它的标准库类型相同,都需要包含对应的头文件 ```C++ #include using name... Hac_Zhang 0 719 ...
(1)在CRectView.h头文件中创建CRect对象 public: CCRectDoc* GetDocument(); CRect h; (2)在CRectView.cpp中添加对颜色的定义 #define RED RGB(255,0,0) #define GREEN RGB(0,255,0) #define BLUE RGB(0,0,255) #define BLACK RGB(0,0,0) ...
两个消息映射的头文件: BEGIN_MESSAGE_MAP() ON_WM_PAINT();//该消息对应头文件中afx_msg void Onpaint()消息处理函数; ON_WM_LBUTTONDOWN();//鼠标作假按下 该消息对应afx_msg void OnLButtonDown(UINT nFlags,CPoint point); 并需要早cpp文件中实现该函数 ...