Pen.LineJoin 属性

定义

获取或设置通过此 Pen 绘制的两条连续直线的端点的联接样式。

public:
 property System::Drawing::Drawing2D::LineJoin LineJoin { System::Drawing::Drawing2D::LineJoin get(); void set(System::Drawing::Drawing2D::LineJoin value); };
public System.Drawing.Drawing2D.LineJoin LineJoin { get; set; }
member this.LineJoin : System.Drawing.Drawing2D.LineJoin with get, set
Public Property LineJoin As LineJoin

属性值

一个 LineJoin,表示通过此 Pen 绘制的两条连续直线的端点的联接样式。

例外

对不可变的 LineJoin(比如由 Pen 类所返回)设置 Pens 属性。

示例

下面的代码示例演示在 上Pen设置 WidthLineJoin 属性的效果。

此示例旨在与 Windows 窗体 一起使用。 将代码粘贴到窗体中,并在处理窗体的 Paint 事件时调用 ShowLineJoin 方法,作为 ePaintEventArgs 传递。

private:
   void ShowLineJoin( PaintEventArgs^ e )
   {
      // Create a new pen.
      Pen^ skyBluePen = gcnew Pen( Brushes::DeepSkyBlue );

      // Set the pen's width.
      skyBluePen->Width = 8.0F;

      // Set the LineJoin property.
      skyBluePen->LineJoin = System::Drawing::Drawing2D::LineJoin::Bevel;

      // Draw a rectangle.
      e->Graphics->DrawRectangle( skyBluePen, Rectangle(40,40,150,200) );

      //Dispose of the pen.
      delete skyBluePen;
   }
private void ShowLineJoin(PaintEventArgs e)
{

    // Create a new pen.
    Pen skyBluePen = new Pen(Brushes.DeepSkyBlue);

    // Set the pen's width.
    skyBluePen.Width = 8.0F;

    // Set the LineJoin property.
    skyBluePen.LineJoin = System.Drawing.Drawing2D.LineJoin.Bevel;

    // Draw a rectangle.
    e.Graphics.DrawRectangle(skyBluePen, 
        new Rectangle(40, 40, 150, 200));

    //Dispose of the pen.
    skyBluePen.Dispose();
}
Private Sub ShowLineJoin(ByVal e As PaintEventArgs)

    ' Create a new pen.
    Dim skyBluePen As New Pen(Brushes.DeepSkyBlue)

    ' Set the pen's width.
    skyBluePen.Width = 8.0F

    ' Set the LineJoin property.
    skyBluePen.LineJoin = Drawing2D.LineJoin.Bevel

    ' Draw a rectangle.
    e.Graphics.DrawRectangle(skyBluePen, _
        New Rectangle(40, 40, 150, 200))

    'Dispose of the pen.
    skyBluePen.Dispose()

End Sub

注解

线条联接是由端点相交或重叠的两条线构成的公共区域。 有三种线联接样式:斜面、棱台和圆形。 为 Pen 对象指定线条联接样式时,该联接样式将应用于使用该笔绘制的任何 GraphicsPath 对象中的所有连接线。 下图演示了棱台线条联接示例的结果。

笔

适用于