GraphicsPath 类

定义

表示一系列相互连接的直线和曲线。Represents a series of connected lines and curves. 此类不能被继承。This class cannot be inherited.

public ref class GraphicsPath sealed : MarshalByRefObject, ICloneable, IDisposable
public sealed class GraphicsPath : MarshalByRefObject, ICloneable, IDisposable
type GraphicsPath = class
    inherit MarshalByRefObject
    interface ICloneable
    interface IDisposable
Public NotInheritable Class GraphicsPath
Inherits MarshalByRefObject
Implements ICloneable, IDisposable
继承
GraphicsPath
实现

注解

应用程序使用路径来绘制形状的轮廓、填充形状的内部和创建剪辑区域。Applications use paths to draw outlines of shapes, fill the interiors of shapes, and create clipping regions. 图形引擎在世界坐标空间内维护路径中几何形状的坐标。The graphics engine maintains the coordinates of geometric shapes in a path in world coordinate space.

路径可以包含任意数量的图形(子路径)。A path may be composed of any number of figures (subpaths). 每个图形均由一系列连接的直线和曲线或几何形状基元组成。Each figure is either composed of a sequence of connected lines and curves or a geometric shape primitive. 图的起点是连接直线和曲线序列中的第一个点。The starting point of a figure is the first point in the sequence of connected lines and curves. 结束点是序列中的最后一个点。The ending point is the last point in the sequence. 几何形状基元的起始点和结束点由基元规范定义。The starting and ending points of a geometric shape primitive are defined by the primitive specification.

由一系列连接的直线和曲线(其起始点和结束点可能一致)组成的图形是开放图形,除非它是显式闭合的。A figure that consists of a sequence of connected lines and curves (whose starting and ending points may be coincident) is an open figure, unless it is closed explicitly. 可以通过使用CloseFigure方法显式关闭图形,该方法通过将线条从结束点连接到起始点来关闭当前图形。A figure can be closed explicitly, by using the CloseFigure method, which closes the current figure by connecting a line from the ending point to the starting point. 由几何形状基元组成的图形是闭合图形。A figure that consists of a geometric shape primitive is a closed figure.

出于填充和剪裁目的(例如,如果使用FillPath呈现路径),将通过从图形的第一个点到最后一个点添加线条来关闭所有打开的图形。For purposes of filling and clipping (for example, if a path is rendered using FillPath), all open figures are closed by adding a line from the figure's first point to its last point.

当创建路径或关闭图形时,将隐式启动一个新图形。A new figure is implicitly started when a path is created or when a figure is closed. 当调用StartFigure方法时,将显式创建一个新图形。A new figure is explicitly created when the StartFigure method is called.

将几何形状基元添加到路径时,它将添加一个包含几何形状的图形,并且还隐式启动一个新图形。When a geometric shape primitive is added to a path, it adds a figure containing the geometric shape, and also implicitly starts a new figure. 因此,在路径中始终有一个当前图形。Consequently, there is always a current figure in a path. 将直线和曲线添加到路径时,会根据需要添加隐式线条,以将当前图形的结束点连接到新直线和曲线的起点,以形成一系列连接的直线和曲线。When lines and curves are added to a path, an implicit line is added as needed to connect the ending point of the current figure to the starting point of the new lines and curves to form a sequence of connected lines and curves.

图有一个方向,该方向说明了如何在起始点和结束点之间跟踪线条和曲线段。A figure has a direction that describes how line and curve segments are traced between the starting point and the ending point. 方向定义为:直线和曲线添加到图形的顺序,或由几何形状基元定义。The direction is defined in the order that lines and curves are added to a figure, or is defined by the geometric shape primitive. 方向用于确定用于剪辑和填充的路径内部。The direction is used in determining the path interiors for clipping and fill.

构造函数

GraphicsPath()

GraphicsPathFillMode 值初始化 Alternate 类的新实例。Initializes a new instance of the GraphicsPath class with a FillMode value of Alternate.

GraphicsPath(FillMode)

使用指定的 GraphicsPath 枚举初始化 FillMode 类的新实例。Initializes a new instance of the GraphicsPath class with the specified FillMode enumeration.

GraphicsPath(Point[], Byte[])

使用指定的 GraphicsPathPathPointType 数组初始化 Point 类的新实例。Initializes a new instance of the GraphicsPath class with the specified PathPointType and Point arrays.

GraphicsPath(Point[], Byte[], FillMode)

使用指定的 GraphicsPathPathPointType 数组以及指定的 Point 枚举元素初始化 FillMode 类的新实例。Initializes a new instance of the GraphicsPath class with the specified PathPointType and Point arrays and with the specified FillMode enumeration element.

GraphicsPath(PointF[], Byte[])

使用指定的 GraphicsPathPathPointType 数组初始化 PointF 数组的新实例。Initializes a new instance of the GraphicsPath array with the specified PathPointType and PointF arrays.

GraphicsPath(PointF[], Byte[], FillMode)

使用指定的 GraphicsPathPathPointType 数组以及指定的 PointF 枚举元素初始化 FillMode 数组的新实例。Initializes a new instance of the GraphicsPath array with the specified PathPointType and PointF arrays and with the specified FillMode enumeration element.

属性

FillMode

获取或设置一个 FillMode 枚举,确定此 GraphicsPath 中的形状的内部如何填充。Gets or sets a FillMode enumeration that determines how the interiors of shapes in this GraphicsPath are filled.

PathData

获取一个 PathData,它封装此 GraphicsPath 的点(points)和类型(types)的数组。Gets a PathData that encapsulates arrays of points (points) and types (types) for this GraphicsPath.

PathPoints

获取路径中的点。Gets the points in the path.

PathTypes

获取 PathPoints 数组中相应点的类型。Gets the types of the corresponding points in the PathPoints array.

PointCount

获取 PathPointsPathTypes 数组中的元素数。Gets the number of elements in the PathPoints or the PathTypes array.

方法

AddArc(Int32, Int32, Int32, Int32, Single, Single)

向当前图形追加一段椭圆弧。Appends an elliptical arc to the current figure.

AddArc(Rectangle, Single, Single)

向当前图形追加一段椭圆弧。Appends an elliptical arc to the current figure.

AddArc(RectangleF, Single, Single)

向当前图形追加一段椭圆弧。Appends an elliptical arc to the current figure.

AddArc(Single, Single, Single, Single, Single, Single)

向当前图形追加一段椭圆弧。Appends an elliptical arc to the current figure.

AddBezier(Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32)

在当前图形中添加一段立方贝塞尔曲线。Adds a cubic Bézier curve to the current figure.

AddBezier(Point, Point, Point, Point)

在当前图形中添加一段立方贝塞尔曲线。Adds a cubic Bézier curve to the current figure.

AddBezier(PointF, PointF, PointF, PointF)

在当前图形中添加一段立方贝塞尔曲线。Adds a cubic Bézier curve to the current figure.

AddBezier(Single, Single, Single, Single, Single, Single, Single, Single)

在当前图形中添加一段立方贝塞尔曲线。Adds a cubic Bézier curve to the current figure.

AddBeziers(Point[])

在当前图形中添加一系列相互连接的立方贝塞尔曲线。Adds a sequence of connected cubic Bézier curves to the current figure.

AddBeziers(PointF[])

在当前图形中添加一系列相互连接的立方贝塞尔曲线。Adds a sequence of connected cubic Bézier curves to the current figure.

AddClosedCurve(Point[])

向此路径添加一个闭合曲线。Adds a closed curve to this path. 由于曲线经过数组中的每个点,因此使用基数样条曲线。A cardinal spline curve is used because the curve travels through each of the points in the array.

AddClosedCurve(Point[], Single)

向此路径添加一个闭合曲线。Adds a closed curve to this path. 由于曲线经过数组中的每个点,因此使用基数样条曲线。A cardinal spline curve is used because the curve travels through each of the points in the array.

AddClosedCurve(PointF[])

向此路径添加一个闭合曲线。Adds a closed curve to this path. 由于曲线经过数组中的每个点,因此使用基数样条曲线。A cardinal spline curve is used because the curve travels through each of the points in the array.

AddClosedCurve(PointF[], Single)

向此路径添加一个闭合曲线。Adds a closed curve to this path. 由于曲线经过数组中的每个点,因此使用基数样条曲线。A cardinal spline curve is used because the curve travels through each of the points in the array.

AddCurve(Point[])

向当前图形添加一段样条曲线。Adds a spline curve to the current figure. 由于曲线经过数组中的每个点,因此使用基数样条曲线。A cardinal spline curve is used because the curve travels through each of the points in the array.

AddCurve(Point[], Int32, Int32, Single)

向当前图形添加一段样条曲线。Adds a spline curve to the current figure.

AddCurve(Point[], Single)

向当前图形添加一段样条曲线。Adds a spline curve to the current figure.

AddCurve(PointF[])

向当前图形添加一段样条曲线。Adds a spline curve to the current figure. 由于曲线经过数组中的每个点,因此使用基数样条曲线。A cardinal spline curve is used because the curve travels through each of the points in the array.

AddCurve(PointF[], Int32, Int32, Single)

向当前图形添加一段样条曲线。Adds a spline curve to the current figure.

AddCurve(PointF[], Single)

向当前图形添加一段样条曲线。Adds a spline curve to the current figure.

AddEllipse(Int32, Int32, Int32, Int32)

向当前路径添加一个椭圆。Adds an ellipse to the current path.

AddEllipse(Rectangle)

向当前路径添加一个椭圆。Adds an ellipse to the current path.

AddEllipse(RectangleF)

向当前路径添加一个椭圆。Adds an ellipse to the current path.

AddEllipse(Single, Single, Single, Single)

向当前路径添加一个椭圆。Adds an ellipse to the current path.

AddLine(Int32, Int32, Int32, Int32)

向当前图形追加一条线段。Appends a line segment to the current figure.

AddLine(Point, Point)

向此 GraphicsPath 追加一条线段。Appends a line segment to this GraphicsPath.

AddLine(PointF, PointF)

向此 GraphicsPath 追加一条线段。Appends a line segment to this GraphicsPath.

AddLine(Single, Single, Single, Single)

向此 GraphicsPath 追加一条线段。Appends a line segment to this GraphicsPath.

AddLines(Point[])

向此 GraphicsPath 末尾追加一系列相互连接的线段。Appends a series of connected line segments to the end of this GraphicsPath.

AddLines(PointF[])

向此 GraphicsPath 末尾追加一系列相互连接的线段。Appends a series of connected line segments to the end of this GraphicsPath.

AddPath(GraphicsPath, Boolean)

将指定的 GraphicsPath 追加到该路径。Appends the specified GraphicsPath to this path.

AddPie(Int32, Int32, Int32, Int32, Single, Single)

向此路径添加一个扇形轮廓。Adds the outline of a pie shape to this path.

AddPie(Rectangle, Single, Single)

向此路径添加一个扇形轮廓。Adds the outline of a pie shape to this path.

AddPie(Single, Single, Single, Single, Single, Single)

向此路径添加一个扇形轮廓。Adds the outline of a pie shape to this path.

AddPolygon(Point[])

向此路径添加多边形。Adds a polygon to this path.

AddPolygon(PointF[])

向此路径添加多边形。Adds a polygon to this path.

AddRectangle(Rectangle)

向此路径添加一个矩形。Adds a rectangle to this path.

AddRectangle(RectangleF)

向此路径添加一个矩形。Adds a rectangle to this path.

AddRectangles(Rectangle[])

向此路径添加一系列矩形。Adds a series of rectangles to this path.

AddRectangles(RectangleF[])

向此路径添加一系列矩形。Adds a series of rectangles to this path.

AddString(String, FontFamily, Int32, Single, Point, StringFormat)

向此路径添加文本字符串。Adds a text string to this path.

AddString(String, FontFamily, Int32, Single, PointF, StringFormat)

向此路径添加文本字符串。Adds a text string to this path.

AddString(String, FontFamily, Int32, Single, Rectangle, StringFormat)

向此路径添加文本字符串。Adds a text string to this path.

AddString(String, FontFamily, Int32, Single, RectangleF, StringFormat)

向此路径添加文本字符串。Adds a text string to this path.

ClearMarkers()

清除此路径的所有标记。Clears all markers from this path.

Clone()

创建此路径的一个精确副本。Creates an exact copy of this path.

CloseAllFigures()

闭合此路径中所有开放的图形并开始一个新图形。Closes all open figures in this path and starts a new figure. 它通过连接一条从图形的终结点到起始点的直线,闭合每一开放的图形。It closes each open figure by connecting a line from its endpoint to its starting point.

CloseFigure()

闭合当前图形并开始新的图形。Closes the current figure and starts a new figure. 如果当前图形包含一系列相互连接的直线和曲线,该方法通过连接一条从终结点到起始点的直线,闭合该环回。If the current figure contains a sequence of connected lines and curves, the method closes the loop by connecting a line from the endpoint to the starting point.

CreateObjRef(Type)

创建一个对象,该对象包含生成用于与远程对象进行通信的代理所需的全部相关信息。Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(继承自 MarshalByRefObject)
Dispose()

释放此 GraphicsPath 使用的所有资源。Releases all resources used by this GraphicsPath.

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
Finalize()

在垃圾回收将某一对象回收前允许该对象尝试释放资源并执行其他清理操作。Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.

Flatten()

将此路径中的各段曲线转换成相连的线段序列。Converts each curve in this path into a sequence of connected line segments.

Flatten(Matrix)

应用指定的变换,然后将此 GraphicsPath 中的各段曲线转换成相连的线段的序列。Applies the specified transform and then converts each curve in this GraphicsPath into a sequence of connected line segments.

Flatten(Matrix, Single)

将此 GraphicsPath 中的各段曲线转换成相连的线段序列。Converts each curve in this GraphicsPath into a sequence of connected line segments.

GetBounds()

返回限定此 GraphicsPath 的矩形。Returns a rectangle that bounds this GraphicsPath.

GetBounds(Matrix)

返回当由指定的 GraphicsPath 对该路径进行变换时,限定此 Matrix 的矩形。Returns a rectangle that bounds this GraphicsPath when this path is transformed by the specified Matrix.

GetBounds(Matrix, Pen)

返回当由指定的 GraphicsPath 对当前路径进行变换并且用指定的 Matrix 绘制该路径时,限定此 Pen 的矩形。Returns a rectangle that bounds this GraphicsPath when the current path is transformed by the specified Matrix and drawn with the specified Pen.

GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetLastPoint()

获取此 PathPointsGraphicsPath 数组中的最后的点。Gets the last point in the PathPoints array of this GraphicsPath.

GetLifetimeService()

检索控制此实例的生存期策略的当前生存期服务对象。Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(继承自 MarshalByRefObject)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
InitializeLifetimeService()

获取生存期服务对象来控制此实例的生存期策略。Obtains a lifetime service object to control the lifetime policy for this instance.

(继承自 MarshalByRefObject)
IsOutlineVisible(Int32, Int32, Pen)

指示当使用指定的 Pen 绘制此 GraphicsPath 时,指定点是否包含在后者的轮廓内(下)。Indicates whether the specified point is contained within (under) the outline of this GraphicsPath when drawn with the specified Pen.

IsOutlineVisible(Int32, Int32, Pen, Graphics)

指示当使用指定的 PenGraphics 绘制此 GraphicsPath 时,指定点是否包含在后者的轮廓内(下)。Indicates whether the specified point is contained within (under) the outline of this GraphicsPath when drawn with the specified Pen and using the specified Graphics.

IsOutlineVisible(Point, Pen)

指示当使用指定的 Pen 绘制此 GraphicsPath 时,指定点是否包含在后者的轮廓内(下)。Indicates whether the specified point is contained within (under) the outline of this GraphicsPath when drawn with the specified Pen.

IsOutlineVisible(Point, Pen, Graphics)

指示当使用指定的 PenGraphics 绘制此 GraphicsPath 时,指定点是否包含在后者的轮廓内(下)。Indicates whether the specified point is contained within (under) the outline of this GraphicsPath when drawn with the specified Pen and using the specified Graphics.

IsOutlineVisible(PointF, Pen)

指示当使用指定的 Pen 绘制此 GraphicsPath 时,指定点是否包含在后者的轮廓内(下)。Indicates whether the specified point is contained within (under) the outline of this GraphicsPath when drawn with the specified Pen.

IsOutlineVisible(PointF, Pen, Graphics)

指示当使用指定的 PenGraphics 绘制此 GraphicsPath 时,指定点是否包含在后者的轮廓内(下)。Indicates whether the specified point is contained within (under) the outline of this GraphicsPath when drawn with the specified Pen and using the specified Graphics.

IsOutlineVisible(Single, Single, Pen)

指示当使用指定的 Pen 绘制此 GraphicsPath 时,指定点是否包含在后者的轮廓内(下)。Indicates whether the specified point is contained within (under) the outline of this GraphicsPath when drawn with the specified Pen.

IsOutlineVisible(Single, Single, Pen, Graphics)

指示当使用指定的 PenGraphics 绘制此 GraphicsPath 时,指定点是否包含在后者的轮廓内(下)。Indicates whether the specified point is contained within (under) the outline of this GraphicsPath when drawn with the specified Pen and using the specified Graphics.

IsVisible(Int32, Int32)

指示指定点是否包含在此 GraphicsPath 内。Indicates whether the specified point is contained within this GraphicsPath.

IsVisible(Int32, Int32, Graphics)

使用指定的 Graphics,指示指定点是否包含在此 GraphicsPath 内。Indicates whether the specified point is contained within this GraphicsPath, using the specified Graphics.

IsVisible(Point)

指示指定点是否包含在此 GraphicsPath 内。Indicates whether the specified point is contained within this GraphicsPath.

IsVisible(Point, Graphics)

指示指定点是否包含在此 GraphicsPath 内。Indicates whether the specified point is contained within this GraphicsPath.

IsVisible(PointF)

指示指定点是否包含在此 GraphicsPath 内。Indicates whether the specified point is contained within this GraphicsPath.

IsVisible(PointF, Graphics)

指示指定点是否包含在此 GraphicsPath 内。Indicates whether the specified point is contained within this GraphicsPath.

IsVisible(Single, Single)

指示指定点是否包含在此 GraphicsPath 内。Indicates whether the specified point is contained within this GraphicsPath.

IsVisible(Single, Single, Graphics)

指示指定点是否包含在此 GraphicsPath 内,它位于指定的 Graphics 的可见剪辑区域内。Indicates whether the specified point is contained within this GraphicsPath in the visible clip region of the specified Graphics.

MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
MemberwiseClone(Boolean)

创建当前 MarshalByRefObject 对象的浅表副本。Creates a shallow copy of the current MarshalByRefObject object.

(继承自 MarshalByRefObject)
Reset()

清空 PathPointsPathTypes 数组并将 FillMode 设置为 AlternateEmpties the PathPoints and PathTypes arrays and sets the FillMode to Alternate.

Reverse()

反转此 PathPointsGraphicsPath 数组中各点的顺序。Reverses the order of points in the PathPoints array of this GraphicsPath.

SetMarkers()

在此 GraphicsPath 上设置标记。Sets a marker on this GraphicsPath.

StartFigure()

不闭合当前图形即开始一个新图形。Starts a new figure without closing the current figure. 后面添加到该路径的所有点都被添加到此新图形中。All subsequent points added to the path are added to this new figure.

ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)
Transform(Matrix)

将变换矩阵应用到此 GraphicsPathApplies a transform matrix to this GraphicsPath.

Warp(PointF[], RectangleF)

对此 GraphicsPath 应用由一个矩形和一个平行四边形定义的扭曲变换。Applies a warp transform, defined by a rectangle and a parallelogram, to this GraphicsPath.

Warp(PointF[], RectangleF, Matrix)

对此 GraphicsPath 应用由一个矩形和一个平行四边形定义的扭曲变换。Applies a warp transform, defined by a rectangle and a parallelogram, to this GraphicsPath.

Warp(PointF[], RectangleF, Matrix, WarpMode)

对此 GraphicsPath 应用由一个矩形和一个平行四边形定义的扭曲变换。Applies a warp transform, defined by a rectangle and a parallelogram, to this GraphicsPath.

Warp(PointF[], RectangleF, Matrix, WarpMode, Single)

对此 GraphicsPath 应用由一个矩形和一个平行四边形定义的扭曲变换。Applies a warp transform, defined by a rectangle and a parallelogram, to this GraphicsPath.

Widen(Pen)

向该路径添加附加轮廓。Adds an additional outline to the path.

Widen(Pen, Matrix)

向该 GraphicsPath 添加附加轮廓。Adds an additional outline to the GraphicsPath.

Widen(Pen, Matrix, Single)

在用指定的钢笔绘制此路径时,用包含所填充区域的曲线代替此 GraphicsPathReplaces this GraphicsPath with curves that enclose the area that is filled when this path is drawn by the specified pen.

适用于

另请参阅