在Winform中绘制自定义椭圆 [英] Draw custom ellipse in winform
本文介绍了在Winform中绘制自定义椭圆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 System.Drawing
和 System.Drawing.Drawing2D
中,我只能绘制水平或垂直形状。现在,我想绘制自定义形状。
In System.Drawing
and System.Drawing.Drawing2D
, I can only draw horizontal or vertical shape. Now i want to draw custom shape.
给出点A,B,C,D的坐标。我想画一个椭圆,如图中的蓝色。
Given the coordinate of points A, B, C, D. I want to draw an ellipse like the blue one in the picture.
推荐答案
下面的示例摘自 MSDN :
private void RotateTransformAngle(PaintEventArgs e)
{
// Set world transform of graphics object to translate.
e.Graphics.TranslateTransform(100.0F, 0.0F);
// Then to rotate, prepending rotation matrix.
e.Graphics.RotateTransform(30.0F);
// Draw rotated, translated ellipse to screen.
e.Graphics.DrawEllipse(new Pen(Color.Blue, 3), 0, 0, 200, 80);
}
这篇关于在Winform中绘制自定义椭圆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文