HDC hdc; HBRUSH hBrush; HPEN hPen; PAINTSTRUCT ptStr; char fir[] = "13%"; char sec[] = "13%"; char thr[] = "20%"; char fou[] = "54%"; char theF[] = "第一季度"; char theS[] = "第二季度"; char theT[] = "第三季度"; char theFo[] = "第四季度"; switch (iMessage) {
case WM_PAINT: hdc = BeginPaint(hWnd, &;ptStr); SetMapMode(hdc, MM_ANISOTROPIC); hPen = (HPEN)GetStockObject(BLACK_PEN); hBrush = (HBRUSH)GetStockObject(LTGRAY_BRUSH); SelectObject(hdc, hBrush); Rectangle(hdc,200,200,400,400); hBrush = CreateSolidBrush(RGB(255,230,0)); SelectObject(hdc, hBrush); Ellipse(hdc,200,200,400,400);
hBrush = CreateSolidBrush(RGB(255,230,210)); SelectObject(hdc, hBrush); Pie(hdc, 200,200,400,400,300,300,0,200); hBrush = CreateSolidBrush(RGB(255,100,100)); SelectObject(hdc, hBrush); Pie(hdc, 200,200,400,400,300,300,300,200); hBrush = CreateSolidBrush(RGB(255,0,100)); SelectObject(hdc, hBrush); Pie(hdc, 200,200,400,400,300,300,400,200);
TextOut(hdc, 300, 410, fou, strlen(fou)); TextOut(hdc, 210, 210, thr, strlen(thr)); TextOut(hdc, 340, 190, sec, strlen(sec)); TextOut(hdc, 400, 270, fir, strlen(fir)); hBrush = (HBRUSH)GetStockObject(WHITE_BRUSH); SelectObject(hdc, hBrush); Rectangle(hdc,500,380,600,220); hBrush = CreateSolidBrush(RGB(255,0,100)); SelectObject(hdc, hBrush); Rectangle(hdc,510,230,520,240); TextOut(hdc, 525, 225, theF, strlen(theF)); hBrush = CreateSolidBrush(RGB(255,230,210)); SelectObject(hdc, hBrush); Rectangle(hdc,510,260,520,270); TextOut(hdc, 525, 255, theS, strlen(theS));
hBrush = CreateSolidBrush(RGB(255,230,0)); SelectObject(hdc, hBrush); Rectangle(hdc,510,290,520,300); TextOut(hdc, 525, 285, theT, strlen(theT));
hBrush = CreateSolidBrush(RGB(255,100,100)); SelectObject(hdc, hBrush); Rectangle(hdc,510,320,520,330); TextOut(hdc, 525, 320, theFo, strlen(theFo)); EndPaint(hWnd, &;ptStr); DeleteObject(hBrush);