Windows API学习-GDI绘图基础与轻量进阶(3)
- 简 介
- 下 载
- 留 言
- 说 明
绘制椭圆
Ellipse() 函数可以用来绘制椭圆,它的原型为:
1 2 3 4 5 6 7 |
BOOL Ellipse( HDC hdc, //设备环境句柄 int nLeftRect, //左上角x坐标 int nTopRect, //左上角y坐标 int nRightRect, //右下角x坐标 int nBottomRect //右下角y坐标 ); |
注意:当 nRightRect - nLeftRect = nBottomRect - nRightRect 时绘制出的是一个圆
1 2 3 4 5 |
case WM_PAINT: hdc = BeginPaint(hwnd, &ps); Ellipse(hdc, 20, 20, 180,90); EndPaint(hwnd, &ps); return 0 ; |
运行效果: