SelectObject(WndDC, RedBrush
Old);
RoundRect(WndDC, 30, 220, 180, 350, 35, 35);
In "SelectObject" vor dem Zeichnen gehört immer das "neue" auszuwählende Object!
In "SelectObject" vor dem Freigeben gehört immer ein default(GetStockObject)/anderes/"altes"(..Old) Object!
//-----------------------------------------------------
OldBrush:=SelectObject(WndDC, GetStockObject(BLACK_BRUSH)); // DummySelect nur zum Abholen des vorherigen Brush
RedBrush := CreateSolidBrush(
RGB(255, 0, 0));
BlueBrush := CreateSolidBrush(
RGB(0,255, 0));
GreenBrush := CreateSolidBrush(
RGB(0,0,255));
//-----------------------------------------------------
SelectObject(WndDC, RedBrush);
Rectangle(WndDC, 80, 10, 100, 90);
SelectObject(WndDC, BlueBrush);
Rectangle(WndDC, 180, 110, 200, 190);
SelectObject(WndDC, GreenBrush);
Rectangle(WndDC, 280, 210, 300, 290);
SelectObject(WndDC, RedBrush);
RoundRect(WndDC, 330, 320, 480, 350, 35, 35);
SelectObject(WndDC, BlueBush);
RoundRect(WndDC, 430, 420, 580, 450, 35, 35);
SelectObject(WndDC, GreenBrush);
RoundRect(WndDC, 530, 520, 680, 550, 35, 35);
//-----------------------------------------------------
SelectObject(WndDC, OldBrush);
DeleteObject(GreenBrush);
DeleteObject(BlueBrush);
DeleteObject(RedBrush);
//-----------------------------------------------------