LineCap LineCap LineCap LineCap Enum

定义

指定可用线帽样式,Pen 对象以该线帽结束一段直线。Specifies the available cap styles with which a Pen object can end a line.

public enum class LineCap
public enum LineCap
type LineCap = 
Public Enum LineCap
继承

字段

AnchorMask AnchorMask AnchorMask AnchorMask 240

指定用于检查线帽是否为锚头帽的掩码。Specifies a mask used to check whether a line cap is an anchor cap.

ArrowAnchor ArrowAnchor ArrowAnchor ArrowAnchor 20

指定箭头状锚头帽。Specifies an arrow-shaped anchor cap.

Custom Custom Custom Custom 255

指定自定义线帽。Specifies a custom line cap.

DiamondAnchor DiamondAnchor DiamondAnchor DiamondAnchor 19

指定菱形锚头帽。Specifies a diamond anchor cap.

Flat Flat Flat Flat 0

指定平线帽。Specifies a flat line cap.

NoAnchor NoAnchor NoAnchor NoAnchor 16

指定没有锚。Specifies no anchor.

Round Round Round Round 2

指定圆线帽。Specifies a round line cap.

RoundAnchor RoundAnchor RoundAnchor RoundAnchor 18

指定圆锚头帽。Specifies a round anchor cap.

Square Square Square Square 1

指定方线帽。Specifies a square line cap.

SquareAnchor SquareAnchor SquareAnchor SquareAnchor 17

指定方锚头帽。Specifies a square anchor line cap.

Triangle Triangle Triangle Triangle 3

指定三角线帽。Specifies a triangular line cap.

示例

下面的示例绘制一个行,其中一端箭头和另一端圆端帽。The following example draws a line with an arrowhead at one end and a round cap at the other end. 若要运行此示例中,创建 Windows 窗体和处理该窗体Paint事件。To run this example, Create a Windows Form and handle the form's Paint event. 示例将代码粘贴到Paint事件处理程序传递e作为PaintEventArgsPaste the example code into the Paint event handler passing e as PaintEventArgs.

Pen pen = new Pen(Color.FromArgb(255, 0, 0, 255), 8);
pen.StartCap = LineCap.ArrowAnchor;
pen.EndCap = LineCap.RoundAnchor;
e.Graphics.DrawLine(pen, 20, 175, 300, 175);
Dim pen As New Pen(Color.FromArgb(255, 0, 0, 255), 8)
pen.StartCap = LineCap.ArrowAnchor
pen.EndCap = LineCap.RoundAnchor
e.Graphics.DrawLine(pen, 20, 175, 300, 175)

注解

可以在一个名为线帽的多个形状绘制的开始或结束的行。You can draw the start or end of a line in one of several shapes called line caps. GDI+GDI+ 支持多种线帽,如 round、 正方形、 菱形和箭头。supports several line caps, such as round, square, diamond, and arrowhead. 下图显示了具有圆端帽和箭头帽的线条。The following illustration shows a line with a round cap and an arrow cap.

笔Pens

适用于

另请参阅