次の方法で共有


ControlPaint.DrawCaptionButton メソッド (Graphics, Rectangle, CaptionButton, ButtonState)

指定したキャプション ボタン コントロールを、指定した状態で、指定したグラフィックスの表面の指定した範囲内に描画します。

Overloads Public Shared Sub DrawCaptionButton( _
   ByVal graphics As Graphics, _   ByVal rectangle As Rectangle, _   ByVal button As CaptionButton, _   ByVal state As ButtonState _)
[C#]
public static void DrawCaptionButton(Graphicsgraphics,Rectanglerectangle,CaptionButtonbutton,ButtonStatestate);
[C++]
public: static void DrawCaptionButton(Graphics* graphics,Rectanglerectangle,CaptionButtonbutton,ButtonStatestate);
[JScript]
public static function DrawCaptionButton(
   graphics : Graphics,rectangle : Rectangle,button : CaptionButton,state : ButtonState);

パラメータ

  • graphics
    描画する Graphics
  • rectangle
    キャプション ボタンの大きさを表す Rectangle
  • button
    描画するキャプション ボタンの種類を指定する CaptionButton 値の 1 つ。
  • state
    描画するボタンの状態を指定する ButtonState 値のビットごとの組み合わせ。

使用例

[Visual Basic, C#] DrawCaptionButton メソッドを使用する方法を次のコード例に示します。この例を実行するには、次のコードを、Button1 という名前のボタンが配置されているフォームに貼り付けます。このフォームは、 System.Windows.Forms 名前空間と System.Drawing 名前空間をインポートします。

 
' Handle the Button1 object's Paint Event to create a CaptionButton.
Private Sub Button1_Paint(ByVal sender As Object, _
    ByVal e As PaintEventArgs) Handles Button1.Paint

    ' Draw a CaptionButton control using the ClientRectangle 
    ' property of Button1. Make the button a Help button 
    ' with a normal state.
    ControlPaint.DrawCaptionButton(e.Graphics, Button1.ClientRectangle, _
        CaptionButton.Help, ButtonState.Normal)
End Sub

[C#] 
// Handle the Button1 object's Paint Event to create a CaptionButton.
private void Button1_Paint(object sender, PaintEventArgs e)
{

    // Draw a CaptionButton control using the ClientRectangle 
    // property of Button1. Make the button a Help button 
    // with a normal state.
    ControlPaint.DrawCaptionButton(e.Graphics, Button1.ClientRectangle,
        CaptionButton.Help, ButtonState.Normal);
}

[C++, JScript] C++ および JScript のサンプルはありません。Visual Basic および C# のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

ControlPaint クラス | ControlPaint メンバ | System.Windows.Forms 名前空間 | ControlPaint.DrawCaptionButton オーバーロードの一覧 | CaptionButton