hdc=BeginPaint(hwnd,&scPaint);
if (hdc)
{
//OutPut Text
SetTextColor(hdc,RGB(255,0,0));
SetBkColor(hdc,RGB(0,0,255));
SetBkMode(hdc,TRANSPARENT);
TextOut(hdc,22,111,"This is GDI Paint!",8);
//Paint Point
SetPixel(hdc,10,10,RGB(255,0,0));
//Paint straight line and triangle
HPEN gPen=CreatePen(PS_SOLID,1,RGB(0,255,0));
HPEN oPen=(HPEN)SelectObject(hdc,gPen);
MoveToEx(hdc,20,22,NULL);
LineTo(hdc,100,111);
LineTo(hdc,400,22);
LineTo(hdc,20,22);
//Paint rectangle
gPen=CreatePen(PS_SOLID,1,RGB(0,255,0));
HBRUSH bBrush=CreateSolidBrush(RGB(0,255,0));
oPen=(HPEN)SelectObject(hdc,gPen);
SelectObject(hdc,bBrush);
Rectangle(hdc,50,150,150,250);
//FillRect
RECT rect;
rect.left=50;
rect.top=270;
rect.right=150;
rect.bottom=370;
FillRect(hdc,&rect,CreateSolidBrush(RGB(0,255,0)));
//FrameRect
rect.left=80;
rect.top=400;
rect.right=200;
rect.bottom=500;
FrameRect(hdc,&rect,CreateSolidBrush(RGB(255,0,0)));
//Paint circular
Ellipse(hdc,200,150,300,250);
//Paint ellipse
Ellipse(hdc,200,270,340,370);
//Paint polygon
POINT gPoint[5]={{420,10},{540,140},{600,100},{550,200},{420,10}};
Polygon(hdc,gPoint,5);
//release resource
SelectObject(hdc,oPen);
DeleteObject(gPen);
DeleteObject(bBrush);
EndPaint(hwnd,&scPaint);
ReleaseDC(hwnd,hdc);
}