DashStyle Enumeración
Definición
public enum class DashStyle
public enum DashStyle
type DashStyle =
Public Enum DashStyle
- Herencia
Campos
Custom | 5 | Especifica un estilo de guión personalizado definido por el usuario.Specifies a user-defined custom dash style. |
Dash | 1 | Especifica una línea formada por guiones.Specifies a line consisting of dashes. |
DashDot | 3 | Especifica una línea formada por un modelo de guión y punto que se repite.Specifies a line consisting of a repeating pattern of dash-dot. |
DashDotDot | 4 | Especifica una línea formada por un modelo de guión, punto y punto que se repite.Specifies a line consisting of a repeating pattern of dash-dot-dot. |
Dot | 2 | Especifica una línea formada por puntos.Specifies a line consisting of dots. |
Solid | 0 | Especifica una línea continua.Specifies a solid line. |
Ejemplos
En el ejemplo de código siguiente se muestra cómo crear un lápiz y establecer su DashStyle propiedad mediante la DashStyle enumeración.The following code example demonstrates how to create a pen and set its DashStyle property using the DashStyle enumeration.
Este ejemplo está diseñado para usarse con Windows Forms.This example is designed to be used with Windows Forms. Cree un formulario que contenga un Button denominado Button3
.Create a form that contains a Button named Button3
. Pegue el código en el formulario y asocie el Button3_Click
método al evento del botón Click .Paste the code into the form and associate the Button3_Click
method with the button's Click event.
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(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 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
Comentarios
Para definir un personalizado DashStyle , establezca la DashPattern propiedad de Pen .To define a custom DashStyle, set the DashPattern property of the Pen.