Biblioteca de clases de .NET Framework
Pen.StartCap (Propiedad)

Obtiene o establece el estilo de extremo que se utiliza al comienzo de las líneas dibujadas con este Pen.

Espacio de nombres: System.Drawing
Ensamblado: System.Drawing (en system.drawing.dll)

Sintaxis

Visual Basic (Declaración)
Public Property StartCap As LineCap
Visual Basic (Uso)
Dim instance As Pen
Dim value As LineCap

value = instance.StartCap

instance.StartCap = value
C#
public LineCap StartCap { get; set; }
C++
public:
property LineCap StartCap {
    LineCap get ();
    void set (LineCap value);
}
J#
/** @property */
public LineCap get_StartCap ()

/** @property */
public void set_StartCap (LineCap value)
JScript
public function get StartCap () : LineCap

public function set StartCap (value : LineCap)

Valor de propiedad

Uno de los valores de LineCap que representa el estilo de extremo utilizado al comienzo de las líneas dibujadas con este Pen.
Excepciones

Tipo de excepciónCondición

InvalidEnumArgumentException

El valor especificado no es un miembro de LineCap.

Ejemplo

En el ejemplo de código siguiente se muestran los efectos de establecer el valor de las propiedades StartCap y EndCap de un Pen.

Este ejemplo se aplica a los formularios Windows Forms. Pegue el código en un formulario y llame al método ShowStartAndEndCaps cuando controle el evento Paint del formulario, pasando e como PaintEventArgs.

Visual Basic
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
C#
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();

}
C++
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;
   }
J#
private void ShowStartAndEndCaps(PaintEventArgs e)
{
    // Create a new custom pen.
    Pen redPen = new Pen(Brushes.get_Red(), 6);

    // Set the StartCap property.
    redPen.set_StartCap(System.Drawing.Drawing2D.LineCap.RoundAnchor);

    // Set the EndCap property.
    redPen.set_EndCap(System.Drawing.Drawing2D.LineCap.ArrowAnchor);

    // Draw a line.
    e.get_Graphics().DrawLine(redPen, 40, 40, 145, 185);

    // Dispose of the custom pen.
    redPen.Dispose();
} //ShowStartAndEndCaps
Plataformas

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium, Windows Mobile para Pocket PC, Windows Mobile para Smartphone, Windows Server 2003, Windows XP Media Center, Windows XP Professional x64, Windows XP SP2, Windows XP Starter Edition

.NET Framework no admite todas las versiones de cada plataforma. Para obtener una lista de las versiones admitidas, vea Requisitos del sistema.

Información de versión

.NET Framework

Compatible con: 2.0, 1.1, 1.0
Vea también

Etiquetas :


Page view tracker