|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
大佬 怎么解决 啊 谢谢了 覆盖 不了 半圆 的边
- 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;
复制代码 |
-
|