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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help Drawing Bitmaps

Status
Not open for further replies.

japhy

Programmer
Sep 27, 2004
12
US
Hi,

I'm trying to draw some simple bitmaps onto a dialog based VC6 app.

I'd like to be able to set the color of individual pixels (and/or groups of pixels)

CDC *pDC;
pDC = (CDC*)&dc;
CBitmap Bmp;
CBrush brBits;

WORD wBits[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };

Bmp.CreateBitmap(8, 8, 1, 2, wBits);
brBits.CreatePatternBrush(&Bmp);
CBrush* pOldBrush = (CBrush*)pDC->SelectObject(&brBits);

pDC->Rectangle(50, 40, 450, 405);

for(int i=0;i<8;i++)
{
pDC->SetPixel(i, 0, RGB(0,255,255));
pDC->SetPixel(i, 1, RGB(255,0,0));
pDC->SetPixel(i, 2, RGB(0,100,100));
pDC->SetPixel(i, 3, RGB(100,255,0));
}
pDC->SelectObject(&Bmp);

All I get is a blank window...What am I doing wrong?

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top