Especifica el estilo de las líneas discontinuas dibujadas con un objeto
Pen.
Espacio de nombres: System.Drawing.Drawing2D
Ensamblado: System.Drawing (en system.drawing.dll)
Visual Basic (Declaración)
Public Enumeration DashStyle
Dim instance As DashStyle
public enum class DashStyle
| | Nombre de miembro | Descripción |
|---|
| Custom | Especifica un estilo de guión personalizado definido por el usuario. |
.gif) | Dash | Especifica una línea formada por guiones. |
| DashDot | Especifica una línea formada por un modelo de guión y punto que se repite. |
| DashDotDot | Especifica una línea formada por un modelo de guión, punto y punto que se repite. |
| Dot | Especifica una línea formada por puntos. |
.gif) | Solid | Especifica una línea continua. |
En el siguiente ejemplo de código se muestra cómo crear un lápiz y establecer su propiedad DashStyle mediante la enumeración DashStyle.
Este ejemplo se aplica a un formulario Windows Forms. Cree un formulario con un botón Button denominado Button3. Pegue el código en el formulario y asocie el método Button3_Click al evento Click del botón.
Private Sub Button3_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button3.Click
Dim buttonGraphics As Graphics = Button3.CreateGraphics()
Dim myPen As Pen = New Pen(Color.ForestGreen, 4.0F)
myPen.DashStyle = Drawing2D.DashStyle.DashDotDot
Dim theRectangle As Rectangle = Button3.ClientRectangle
theRectangle.Inflate(-2, -2)
buttonGraphics.DrawRectangle(myPen, theRectangle)
buttonGraphics.Dispose()
myPen.Dispose()
End Sub
private void Button3_Click(System.Object sender, System.EventArgs e)
{
Graphics buttonGraphics = Button3.CreateGraphics();
Pen myPen = new Pen(Color.ForestGreen, 4.0F);
myPen.DashStyle = System.Drawing.Drawing2D.DashStyle.DashDotDot;
Rectangle theRectangle = Button3.ClientRectangle;
theRectangle.Inflate(-2, -2);
buttonGraphics.DrawRectangle(myPen, theRectangle);
buttonGraphics.Dispose();
myPen.Dispose();
}
private:
void Button3_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ )
{
Graphics^ buttonGraphics = Button3->CreateGraphics();
Pen^ myPen = gcnew Pen( Color::ForestGreen,4.0F );
myPen->DashStyle = System::Drawing::Drawing2D::DashStyle::DashDotDot;
Rectangle theRectangle = Button3->ClientRectangle;
theRectangle.Inflate( -2, -2 );
buttonGraphics->DrawRectangle( myPen, theRectangle );
delete buttonGraphics;
delete myPen;
}
private void button3_Click(Object sender, System.EventArgs e)
{
Graphics buttonGraphics = button3.CreateGraphics();
Pen myPen = new Pen(Color.get_ForestGreen(), 4.0F);
myPen.set_DashStyle(System.Drawing.Drawing2D.DashStyle.DashDotDot);
Rectangle theRectangle = button3.get_ClientRectangle();
theRectangle.Inflate(-2, -2);
buttonGraphics.DrawRectangle(myPen, theRectangle);
buttonGraphics.Dispose();
myPen.Dispose();
} //button3_Click
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.
.NET Framework
Compatible con: 2.0, 1.1, 1.0
.NET Compact Framework
Compatible con: 2.0