Jump to content
  • Advertisement


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


Making colored squares

This topic is 5922 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
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

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!