Pen.EndCap Proprietà

Definizione

Ottiene o imposta il tipo di terminazione usato alla fine delle linee disegnate con questo oggetto Pen.

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

Valore della proprietà

Uno dei valori LineCap che rappresenta il tipo di terminazione usato alla fine delle linee disegnate con questo oggetto Pen.

Eccezioni

Il valore specificato non è un membro di LineCap.

La proprietà EndCap è impostata su un oggetto Pen non modificabile, ad esempio quelli restituiti dalla classe Pens.

Esempio

Nell'esempio di codice seguente vengono illustrati gli effetti dell'impostazione delle StartCap proprietà e EndCap in un oggetto Pen.

Questo esempio è progettato per essere usato con Windows Forms. Incollare il codice in una maschera e chiamare il metodo quando si gestisce l'evento ShowStartAndEndCaps del Paint modulo, passando e come PaintEventArgs.

private:
   void ShowStartAndEndCaps( PaintEventArgs^ e )
   {
      // Create a new custom pen.
      Pen^ redPen = gcnew Pen( Brushes::Red,6.0F );

      // Set the StartCap property.
      redPen->StartCap = System::Drawing::Drawing2D::LineCap::RoundAnchor;

      // Set the EndCap property.
      redPen->EndCap = System::Drawing::Drawing2D::LineCap::ArrowAnchor;

      // Draw a line.
      e->Graphics->DrawLine( redPen, 40.0F, 40.0F, 145.0F, 185.0F );

      // Dispose of the custom pen.
      delete redPen;
   }
private void ShowStartAndEndCaps(PaintEventArgs e)
{

    // Create a new custom pen.
    Pen redPen = new Pen(Brushes.Red, 6.0F);

    // Set the StartCap property.
    redPen.StartCap = System.Drawing.Drawing2D.LineCap.RoundAnchor;

    // Set the EndCap property.
    redPen.EndCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor;

    // Draw a line.
    e.Graphics.DrawLine(redPen, 40.0F, 40.0F, 145.0F, 185.0F);

    // Dispose of the custom pen.
    redPen.Dispose();
}
Private Sub ShowStartAndEndCaps(ByVal e As PaintEventArgs)

    ' Create a new custom pen.
    Dim redPen As New Pen(Brushes.Red, 6.0F)

    ' Set the StartCap property.
    redPen.StartCap = Drawing2D.LineCap.RoundAnchor

    ' Set the EndCap property.
    redPen.EndCap = Drawing2D.LineCap.ArrowAnchor

    ' Draw a line.
    e.Graphics.DrawLine(redPen, 40.0F, 40.0F, 145.0F, 185.0F)

    ' Dispose of the custom pen.
    redPen.Dispose()

End Sub

Si applica a