?
Super! Danke. Hab die Funktion eingebaut. Das Bild wird erstellt. Die Sache hat nur einen kleinen Schönheitsfehler: Das Bild ist nur weiß!
void CBitDlg::OnButton1()
{
CDC DC;
CDC* pDC = GetDC();
CBitmap Bitmap;
DC.CreateCompatibleDC(pDC);
Bitmap.CreateCompatibleBitmap(pDC, 500, 500);
DC.SelectObject(Bitmap);
BeginWaitCursor();
DC.FillSolidRect(0,0,500,500, RGB(0,255,255));
DC.MoveTo(80, 500);
int y = 0;
for(int x = -20; x <= 20; x++)
{
y = (x * x);
DC.SetPixel(x + 100, y + 100, RGB(255, 0, 0));
}
EndWaitCursor();
HBITMAP hMyBitmap = (HBITMAP) Bitmap;
pDC->BitBlt( 0, 0, 500, 500, &DC, 0, 0 , SRCCOPY);
m_ctlImg.SetBitmap(hMyBitmap);
WriteBitmap("C:\\Windows\\Desktop\\test.bmp", hMyBitmap, *pDC);
}