case WM_PAINT:
hdc = BeginPaint(hwnd, &ps);
GetClientRect(hwnd, &rect);
//判断窗口的高度和宽度的大小
if (rect.bottom < rect.right)
{
//画一个填充为黑色的半圆
SelectObject(hdc,GetStockObject(BLACK_BRUSH));
Pie(hdc, rect.right / 2 - rect.bottom / 2, rect.top, rect.right / 2 + rect.bottom / 2, rect.bottom, rect.right / 2, rect.top, rect.right / 2, rect.bottom);
//画一个填充为白色的半圆
SelectObject(hdc, GetStockObject(WHITE_BRUSH));
Pie(hdc, rect.right / 2 - rect.bottom / 2, rect.top, rect.right / 2 + rect.bottom / 2, rect.bottom, rect.right / 2, rect.bottom, rect.right / 2, rect.top);
//画一个填充为黑色的半圆
SelectObject(hdc, GetStockObject(BLACK_BRUSH));
Pie(hdc, rect.right / 2 - rect.bottom / 4, rect.top, rect.right / 2 + rect.bottom / 4, rect.bottom/2, rect.right / 2, rect.bottom / 2, rect.right / 2, rect.top);
//画一个填充为白色的半圆
SelectObject(hdc, GetStockObject(WHITE_BRUSH));
Pie(hdc, rect.right / 2 - rect.bottom / 4, rect.bottom / 2, rect.right / 2 + rect.bottom / 4, rect.bottom, rect.right / 2, rect.bottom / 2, rect.right / 2, rect.bottom);
//覆盖掉白色半圆的边
SelectObject(hdc, GetStockObject(WHITE_PEN));
MoveToEx(hdc, rect.right / 2, rect.bottom / 2, 0);
LineTo(hdc, rect.right / 2, rect.bottom);
//恢复画笔
SelectObject(hdc,GetStockObject(BLACK_PEN));
//白色园
SelectObject(hdc, GetStockObject(WHITE_BRUSH));
Ellipse(hdc, rect.right / 2 - 20, rect.bottom / 4 - 20, rect.right / 2 + 20, rect.bottom / 4 + 20);
//黑色园
SelectObject(hdc, GetStockObject(BLACK_BRUSH));
Ellipse(hdc, rect.right / 2 - 20, 3*rect.bottom / 4 - 20, rect.right / 2 + 20, 3*rect.bottom / 4 + 20);
//重新设置画刷
SelectObject(hdc, GetStockObject(WHITE_BRUSH));
}
EndPaint(hwnd, &ps);
break;