Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MFC: CreateSolidBrush

Status
Not open for further replies.

Crisps

Programmer
Sep 28, 2006
26
US
If I do a

Code:
hDC = GetDC(m_hWnd);
m_hDC = CreateCompatibleDC(hDC);
m_hBrush = CreateSolidBrush(RGB(0xFF, 0, 0));

SelectObject(m_hDC, m_hBrush)

RECT rect;

rect.top = (m_ry * m_iSize) + m_iOffsetY;
rect.left = (m_rx * m_iSize) + m_iOffsetX;
rect.right = ((m_rx + 1) * m_iSize) + m_iOffsetX;
rect.bottom = ((m_ry + 1) * m_iSize) + m_iOffsetX;

FillRect(m_hDC, &rect, m_hBrush);

I get a black and white patterned square instead of a nice red square. Any idea how this could happen. (I am using a colour display :) and a normal window)

Thanks,
 
sorry, this is GDI not MFC. the m_hBrush is just a handle (HBRUSH)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top