• Advertisement

Archived

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

Making colored squares

This topic is 5652 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

A dialog box in an application i''m making has to display a solid filled square of a color. Is this a job for BitBlt or something? I can''t quite figure this out.

Share this post


Link to post
Share on other sites
Advertisement
Not BitBlt, use FillRect instead (though you could use bitblt and show a bitmap with only one colour).

example:

  

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

  • Advertisement