DashStyle 列挙体
アセンブリ: System.Drawing (system.drawing.dll 内)
構文
Public Enumeration DashStyle
メンバ名 | 説明 | |
---|---|---|
Custom | ユーザー定義のカスタム ダッシュ スタイルを指定します。 | |
Dash | ダッシュで構成される直線を指定します。 | |
DashDot | ダッシュとドットの繰り返しパターンで構成される直線を指定します。 | |
DashDotDot | ダッシュと 2 つのドットの繰り返しパターンで構成される直線を指定します。 | |
Dot | ドットで構成される直線を指定します。 | |
Solid | 実線を指定します。 |
DashStyle 列挙体を使用して、ペンを作成し、DashStyle プロパティを設定するコード例を次に示します。
この例は、Windows フォームでの使用を意図してデザインされています。Button3 という名前の Button を格納するフォームを作成します。コードをフォームに貼り付け、Button3_Click メソッドをボタンの Click イベントに関連付けます。
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 Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
- DashStyle 列挙体のページへのリンク