Pen クラスとは? わかりやすく解説

Pen クラス

直線および曲線描画使用するオブジェクト定義します。このクラス継承できません。

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public NotInheritable Class
 Pen
    Inherits MarshalByRefObject
    Implements ICloneable, IDisposable
public sealed class Pen : MarshalByRefObject,
 ICloneable, IDisposable
public ref class Pen sealed : public
 MarshalByRefObject, ICloneable, IDisposable
public final class Pen extends MarshalByRefObject
 implements ICloneable, IDisposable
public final class Pen extends
 MarshalByRefObject implements ICloneable, IDisposable
解説解説
使用例使用例

次のコード例は、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.Object
   System.MarshalByRefObject
    System.Drawing.Pen
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からPen クラスを検索した結果を表示しています。
Weblioに収録されているすべての辞書からPen クラスを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からPen クラス を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「Pen クラス」の関連用語

Pen クラスのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Pen クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS