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
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