tom*_*omu 3 c# user-interface drawing gdi+
如果在 Graphicspath 中添加一条线并定义了两端位置,是否可以读取这对点?
Point[] myArray =
{
new Point(30,30),
new Point(60,60),
};
GraphicsPath myPath2 = new GraphicsPath();
myPath2.AddLines(myArray2);
Run Code Online (Sandbox Code Playgroud)
从 myPath2 中,是否有类似的东西myPath2.Location可以给我点(30,30)和(60,60)?谢谢
是的,可以通过,GraphicsPath.PathPoints 但您需要了解第二个数组GraphicsPath.PathTypes!
仅当所有点都添加为线坐标的简单点数组时,可能像这样:
\n\nList<Point> points = new List<Point>();\n.. // add some points!\nGraphicsPath gp = new GraphicsPath();\ngp.AddLines(points.ToArray());\nRun Code Online (Sandbox Code Playgroud)\n\n您是否能够轻松使用/修改积分?
\n\n如果您通过圆形添加它们,例如..
\n\n gp.AddEllipse(ClientRectangle);\nRun Code Online (Sandbox Code Playgroud)\n\n..您需要了解各种类型!将它们添加为其他曲线时也是如此 gp.AddCurves(points.ToArray());
如果您添加它们,gp.AddRectangle(ClientRectangle);您将获得常规点,但字节类型表示
\n\n\n0 - 表示该点是图形的起点。
\n
因此,在您的情况下,您会得到这样的第一点:
\n\nConsole.WriteLine(gp.PathPoints[1].ToString());\nRun Code Online (Sandbox Code Playgroud)\n\n顺便说一句:不存在“a”这样的东西GraphicsPath.Location。但你可能会发现GraphicsPath.GetBounds()有用..
请注意,所有圆形形状(包括圆弧和椭圆!)实际上仅由贝塞尔点组成:
\n\n\n\n\n3 - 表示该点是三次 B\xc3\xa9zier 样条曲线的端点或控制点
\n
这意味着端点和控制点PathPoints是交替的。
| 归档时间: |
|
| 查看次数: |
2055 次 |
| 最近记录: |