Language

ControlPaint.DrawFocusRectangle メソッド

定義

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

オーバーロード

名前 説明
DrawFocusRectangle(Graphics, Rectangle, Color, Color)

指定したグラフィックスサーフェイスおよび指定した境界内にフォーカス四角形を描画します。

DrawFocusRectangle(Graphics, Rectangle)

指定したグラフィックスサーフェイスおよび指定した境界内にフォーカス四角形を描画します。

DrawFocusRectangle(Graphics, Rectangle, Color, Color)

ソース:
ControlPaint.cs
ソース:
ControlPaint.cs
ソース:
ControlPaint.cs
ソース:
ControlPaint.cs
ソース:
ControlPaint.cs

指定したグラフィックスサーフェイスおよび指定した境界内にフォーカス四角形を描画します。

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 。

例

次のコード例では、 DrawFocusRectangle メソッドと Control.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 が使用する点線の四角形です。

適用対象

DrawFocusRectangle(Graphics, Rectangle)

ソース:
ControlPaint.cs
ソース:
ControlPaint.cs
ソース:
ControlPaint.cs
ソース:
ControlPaint.cs
ソース:
ControlPaint.cs

指定したグラフィックスサーフェイスおよび指定した境界内にフォーカス四角形を描画します。

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 。

例

次のコード例では、 DrawFocusRectangle メソッドと Control.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 が使用する点線の四角形です。

適用対象