HDC hdc = ::GetDC(m_hWnd); RECT rect = { 10,10,50,100 }; HBRUSH hbr; hbr = CreateSolidBrush(RGB(255, 0, 0)); int f = FrameRect(hdc, &rect, hbr);//绘制矩形边框 /* 参数1:HDC hdc 将要画边框的设备环境句柄 参数2:CONST RECT *lprc 指向包含矩形左上角和右下角逻辑坐标的结构RECT的指针。也可以传递一个CRECT对象给这个参数 参数3:HBRUSH hbr 画刷句柄 返回值:如果函数调用成功,返回值非零;如果函数调用失败,返回值是0 如果RECT结构中的底部成员的值少于或等于顶部成员,或右部成员少于或等于左部成员,此函数画不了矩形 */ DeleteObject(hbr); ::ReleaseDC(m_hWnd, hdc);
缺点:矩形边框无法加粗
- 矩形 边框 MFC-FrameRect FrameRect MFC矩形 边框mfc-framerect framerect mfc-framerect 矩形mfc-getwindowrect边框getwindowrect 一统天下 矩形 边框 圆形 矩形mfc-rectangle rectangle mfc 矩形mfc-fillrect fillrect mfc 矩形mfc-setrectempty坐标setrectempty 集部 矩形mfc-unionrect unionrect 矩形mfc-offsetrect offsetrect mfc 矩形mfc-isrectempty isrectempty mfc