This topic is now archived and is closed to further replies.


Making colored squares

Recommended Posts

Not BitBlt, use FillRect instead (though you could use bitblt and show a bitmap with only one colour).



HDC hDC = GetDC(hDlg);
HBRUSH hBrush = CreateSolidBrush(RGB(255, 0, 0));
RECT rcBox = {0, 0, 50, 50}; // Set to where you want the box

FillRect(hDC, &rcBox, hBrush);
ReleaseDC(hDlg, hDC);

I think that should work, though it may be better to draw in the WM_PAINT message and get a DC via BeginPaint.

Share this post

Link to post
Share on other sites