DashStyle 열거형

정의

Pen 개체를 사용하여 그린 파선의 스타일을 지정합니다.

public enum class DashStyle
public enum DashStyle
type DashStyle = 
Public Enum DashStyle
상속
DashStyle

필드

Custom 5

사용자 정의 파선 스타일을 지정합니다.

Dash 1

대시로 구성된 파선을 지정합니다.

DashDot 3

대시와 점이 반복되는 선을 지정합니다.

DashDotDot 4

대시와 두 개의 점이 반복되는 선을 지정합니다.

Dot 2

점으로 구성된 선을 지정합니다.

Solid 0

실선을 지정합니다.

예제

다음 코드 예제에서는 펜을 만들고 열거형을 사용 하 여 해당 DashStyle 속성을 설정 하는 DashStyle 방법을 보여 줍니다.

이 예제는 Windows Forms 함께 사용하도록 설계되었습니다. 라는 Button3가 포함된 양식을 만듭니다Button. 코드를 양식에 붙여넣고 메서드를 Button3_Click 단추의 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

설명

사용자 지정 DashStyle를 정의하려면 의 DashPatternPen속성을 설정합니다.

적용 대상

추가 정보