ControlPaint.DrawFocusRectangle メソッド (Graphics, Rectangle)
フォーカスを示す四角形を、指定したグラフィックスの表面の指定した範囲内に描画します。
Overloads Public Shared Sub DrawFocusRectangle( _
ByVal graphics As Graphics, _ ByVal rectangle As Rectangle _)
[C#]
public static void DrawFocusRectangle(Graphicsgraphics,Rectanglerectangle);
[C++]
public: static void DrawFocusRectangle(Graphics* graphics,Rectanglerectangle);
[JScript]
public static function DrawFocusRectangle(
graphics : Graphics,rectangle : Rectangle);
パラメータ
解説
フォーカスを示す四角形は、現在のキーボード フォーカスを持つコントロールを示すために Windows で使用される点線の四角形です。
使用例
[Visual Basic, C#] DrawFocusRectangle メソッドと Handle プロパティを使用するコード例を次に示します。この例を実行するには、次のコードをフォームに貼り付けます。そして、Button1 および Button2 という名前の 2 つのボタンを追加し、すべてのイベントを必ずそれぞれのイベント処理メソッドに関連付けます。
' This method draws a focus rectangle on Button2 using the
' handle and client rectangle of Button2.
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
ControlPaint.DrawFocusRectangle(Graphics.FromHwnd(Button2.Handle), _
Button2.ClientRectangle)
End Sub
[C#]
// This method draws a focus rectangle on Button2 using the
// handle and client rectangle of Button2.
private void Button1_Click(System.Object sender, System.EventArgs e)
{
ControlPaint.DrawFocusRectangle(Graphics.FromHwnd(Button2.Handle),
Button2.ClientRectangle);
}
[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.DrawFocusRectangle オーバーロードの一覧