Sdílet prostřednictvím


DashStyle Výčet

Definice

Určuje styl přerušovaných čar nakreslených Pen objektem.

public enum class DashStyle
public enum DashStyle
type DashStyle = 
Public Enum DashStyle
Dědičnost
DashStyle

Pole

Name Hodnota Description
Solid 0

Určuje plnou čáru.

Dash 1

Určuje čáru skládající se z pomlček.

Dot 2

Určuje čáru skládající se z tečk.

DashDot 3

Určuje čáru skládající se z opakujícího se vzoru přerušované tečky.

DashDotDot 4

Určuje čáru skládající se z opakujícího se vzoru přerušované tečky.

Custom 5

Určuje uživatelsky definovaný vlastní styl pomlčky.

Příklady

Následující příklad kódu ukazuje, jak vytvořit pero a nastavit jeho DashStyle vlastnost pomocí výčtu DashStyle .

Tento příklad je navržený tak, aby se používal s Windows Forms. Vytvořte formulář, který obsahuje pojmenovaný ButtonButton3. Vložte kód do formuláře a přidružte Button3_Click metodu k události tlačítka Click .

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

Poznámky

Chcete-li definovat vlastní DashStyle, nastavte DashPattern vlastnost Pen.

Platí pro

Viz také