Pen クラス
アセンブリ: System.Drawing (system.drawing.dll 内)

Public NotInheritable Class Pen Inherits MarshalByRefObject Implements ICloneable, IDisposable

Pen は、指定の幅およびスタイルの直線を描画します。さまざまな破線を描画するには DashStyle プロパティを使用します。Pen で描画した直線は、純色、テクスチャなど、さまざまな塗りつぶしスタイルで塗りつぶすことができます。塗りつぶしスタイルは、塗りつぶしオブジェクトに使用するブラシまたはテクスチャによって異なります。

次のコード例は、Brush を使用して Pen を作成する方法と、Pen で LineJoin プロパティを設定することの効果を示しています。
この例は、Windows フォームでの使用を意図してデザインされています。コードをフォームに貼り付け、フォームの Paint イベントを処理するときに PaintEventArgs の e を渡して ShowLineJoin メソッドを呼び出します。
Private Sub ShowLineJoin(ByVal e As PaintEventArgs) ' Create a new pen. Dim skyBluePen As New Pen(Brushes.DeepSkyBlue) ' Set the pen's width. skyBluePen.Width = 8.0F ' Set the LineJoin property. skyBluePen.LineJoin = Drawing2D.LineJoin.Bevel ' Draw a rectangle. e.Graphics.DrawRectangle(skyBluePen, _ New Rectangle(40, 40, 150, 200)) 'Dispose of the pen. skyBluePen.Dispose() End Sub
private void ShowLineJoin(PaintEventArgs e) { // Create a new pen. Pen skyBluePen = new Pen(Brushes.DeepSkyBlue); // Set the pen's width. skyBluePen.Width = 8.0F; // Set the LineJoin property. skyBluePen.LineJoin = System.Drawing.Drawing2D.LineJoin.Bevel; // Draw a rectangle. e.Graphics.DrawRectangle(skyBluePen, new Rectangle(40, 40, 150, 200)); //Dispose of the pen. skyBluePen.Dispose(); }
private: void ShowLineJoin( PaintEventArgs^ e ) { // Create a new pen. Pen^ skyBluePen = gcnew Pen( Brushes::DeepSkyBlue ); // Set the pen's width. skyBluePen->Width = 8.0F; // Set the LineJoin property. skyBluePen->LineJoin = System::Drawing::Drawing2D::LineJoin::Bevel; // Draw a rectangle. e->Graphics->DrawRectangle( skyBluePen, Rectangle(40,40,150,200) ); //Dispose of the pen. delete skyBluePen; }
private void ShowLineJoin(PaintEventArgs e) { // Create a new pen. Pen skyBluePen = new Pen(Brushes.get_DeepSkyBlue()); // Set the pen's width. skyBluePen.set_Width(8); // Set the LineJoin property. skyBluePen.set_LineJoin(System.Drawing.Drawing2D.LineJoin.Bevel); // Draw a rectangle. e.get_Graphics().DrawRectangle(skyBluePen, new Rectangle(40, 40, 150, 200)); //Dispose of the pen. skyBluePen.Dispose(); } //ShowLineJoin

System.MarshalByRefObject
System.Drawing.Pen


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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からPen クラスを検索する場合は、下記のリンクをクリックしてください。

- Pen クラスのページへのリンク