c++ windows api 设置矩形的颜色
caseWM_PAINT:HDChdc;PAINTSTRUCTps;hdc=BeginPaint(hwnd,&ps);SetTextColor(hdc,0X0000FF)...
case WM_PAINT:
HDC hdc;
PAINTSTRUCT ps;
hdc=BeginPaint(hwnd,&ps);
SetTextColor(hdc, 0X0000FF);
SetBkColor(hdc, RGB(00, 152, 255));
Rectangle(hdc,50,50,200,200); //矩形颜色没改变???怎样设置
TextOut(hdc,0,0,"wdd",3); //字体的颜色已经设置成功,为什么设置矩形颜色不起作用
EndPaint(hwnd,&ps);
break; 展开
HDC hdc;
PAINTSTRUCT ps;
hdc=BeginPaint(hwnd,&ps);
SetTextColor(hdc, 0X0000FF);
SetBkColor(hdc, RGB(00, 152, 255));
Rectangle(hdc,50,50,200,200); //矩形颜色没改变???怎样设置
TextOut(hdc,0,0,"wdd",3); //字体的颜色已经设置成功,为什么设置矩形颜色不起作用
EndPaint(hwnd,&ps);
break; 展开
展开全部
使用GDI+绘画矩形:
api:
Status DrawRectangle( const Pen* pen, const Rect& rect);
代码例子:
VOID Example_DrawRectangle(HDC hdc)
{
Graphics graphics(hdc);
// Create a Pen object.
Pen blackPen(Color(255, 0, 0, 0), 3);
// Create a Rect object.
Rect rect(0, 0, 200, 200);
// Draw rect.
graphics.DrawRectangle(&blackPen, rect);
}
api:
Status DrawRectangle( const Pen* pen, const Rect& rect);
代码例子:
VOID Example_DrawRectangle(HDC hdc)
{
Graphics graphics(hdc);
// Create a Pen object.
Pen blackPen(Color(255, 0, 0, 0), 3);
// Create a Rect object.
Rect rect(0, 0, 200, 200);
// Draw rect.
graphics.DrawRectangle(&blackPen, rect);
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询