ControlPaint.DrawFocusRectangle メソッド

定義

フォーカスを示す四角形を描画します。

オーバーロード

DrawFocusRectangle(Graphics, Rectangle, Color, Color)

フォーカスを示す四角形を、指定したグラフィックスの表面の指定した範囲内に描画します。

DrawFocusRectangle(Graphics, Rectangle)

フォーカスを示す四角形を、指定したグラフィックスの表面の指定した範囲内に描画します。

DrawFocusRectangle(Graphics, Rectangle, Color, Color)

フォーカスを示す四角形を、指定したグラフィックスの表面の指定した範囲内に描画します。

public:
 static void DrawFocusRectangle(System::Drawing::Graphics ^ graphics, System::Drawing::Rectangle rectangle, System::Drawing::Color foreColor, System::Drawing::Color backColor);
public static void DrawFocusRectangle (System.Drawing.Graphics graphics, System.Drawing.Rectangle rectangle, System.Drawing.Color foreColor, System.Drawing.Color backColor);
static member DrawFocusRectangle : System.Drawing.Graphics * System.Drawing.Rectangle * System.Drawing.Color * System.Drawing.Color -> unit
Public Shared Sub DrawFocusRectangle (graphics As Graphics, rectangle As Rectangle, foreColor As Color, backColor As Color)

パラメーター

graphics
Graphics

描画する Graphics

rectangle
Rectangle

グラブ ハンドル グリフの大きさを表す Rectangle

foreColor
Color

フォーカスを示す四角形を描画するオブジェクトの前景色である Color

backColor
Color

フォーカスを示す四角形を描画するオブジェクトの背景色である Color

次のコード例は、メソッドとプロパティの使用をDrawFocusRectangleControl.Handle示しています。 この例を実行するには、次のコードをフォームに貼り付けます。 フォームに Button2 という名前 Button1 の 2 つのボタンを追加し、すべてのイベントがイベント ハンドラーに接続されていることを確認します。

// This method draws a focus rectangle on Button2 using the 
// handle and client rectangle of Button2.
void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ )
{
   ControlPaint::DrawFocusRectangle( Graphics::FromHwnd( Button2->Handle ), Button2->ClientRectangle );
}
// 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);
}
' 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

注釈

フォーカスの四角形は、現在のキーボード フォーカスを持つコントロールWindows示すために使用する点線の四角形です。

適用対象

DrawFocusRectangle(Graphics, Rectangle)

フォーカスを示す四角形を、指定したグラフィックスの表面の指定した範囲内に描画します。

public:
 static void DrawFocusRectangle(System::Drawing::Graphics ^ graphics, System::Drawing::Rectangle rectangle);
public static void DrawFocusRectangle (System.Drawing.Graphics graphics, System.Drawing.Rectangle rectangle);
static member DrawFocusRectangle : System.Drawing.Graphics * System.Drawing.Rectangle -> unit
Public Shared Sub DrawFocusRectangle (graphics As Graphics, rectangle As Rectangle)

パラメーター

graphics
Graphics

描画する Graphics

rectangle
Rectangle

グラブ ハンドル グリフの大きさを表す Rectangle

次のコード例は、メソッドとプロパティの使用をDrawFocusRectangleControl.Handle示しています。 この例を実行するには、次のコードをフォームに貼り付けます。 フォームに名前付きの Button1 Button2 2 つのボタンを追加し、すべてのイベントがイベント ハンドラーに接続されていることを確認します。

// This method draws a focus rectangle on Button2 using the 
// handle and client rectangle of Button2.
void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ )
{
   ControlPaint::DrawFocusRectangle( Graphics::FromHwnd( Button2->Handle ), Button2->ClientRectangle );
}
// 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);
}
' 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

注釈

フォーカスの四角形は、現在のキーボード フォーカスを持つコントロールWindows示すために使用する点線の四角形です。

適用対象