winApi一日一练之 CreateSolidBrush(和FillRect)

/////声明矩形
RECT rcText;
rcText.left = 10;
rcText.right=100;
rcText.top = 20;
rcText.bottom=300;

hdc = BeginPaint(hWnd, &ps);

HBRUSH brush = CreateSolidBrush(RGB(66,66,66));
FillRect(hdc,&rcText,brush);
DeleteObject(brush);////记得及时释放内存

   DrawText(hdc,strShow.c_str(),(int)strShow.length(),
&rcText,DT_SINGLELINE|DT_LEFT|DT_END_ELLIPSIS);

// TODO: 在此添加任意绘图代码...
EndPaint(hWnd, &ps);


你可能感兴趣的:(winApi一日一练之 CreateSolidBrush(和FillRect))