ControlPaint.DrawFocusRectangle Metoda

Definice

Nakreslí obdélník fokusu.

Přetížení

DrawFocusRectangle(Graphics, Rectangle, Color, Color)

Nakreslí obdélník fokusu na zadanou grafickou plochu a v rámci zadaných hranic.

DrawFocusRectangle(Graphics, Rectangle)

Nakreslí obdélník fokusu na zadanou grafickou plochu a v rámci zadaných hranic.

DrawFocusRectangle(Graphics, Rectangle, Color, Color)

Nakreslí obdélník fokusu na zadanou grafickou plochu a v rámci zadaných hranic.

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)

Parametry

graphics
Graphics

Nakreslený Graphics .

rectangle
Rectangle

To Rectangle představuje rozměry úchytu glyph.

foreColor
Color

Jedná se Color o barvu popředí objektu, na kterou chcete nakreslit obdélník fokusu.

backColor
Color

Jedná se Color o barvu pozadí objektu, na kterou chcete nakreslit obdélník fokusu.

Příklady

Následující příklad kódu ukazuje použití DrawFocusRectangle metody a Control.Handle vlastnosti. Pokud chcete tento příklad spustit, vložte do formuláře následující kód. Přidejte do formuláře dvě tlačítka pojmenovaná Button1 a Button2 a ujistěte se, že jsou všechny události připojené k obslužným rutinám událostí.

// 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

Poznámky

Obdélník fokusu je tečkovaný obdélník, který Windows používá k označení toho, jaký ovládací prvek má aktuální fokus klávesnice.

Platí pro

DrawFocusRectangle(Graphics, Rectangle)

Nakreslí obdélník fokusu na zadanou grafickou plochu a v rámci zadaných hranic.

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)

Parametry

graphics
Graphics

Nakreslený Graphics .

rectangle
Rectangle

To Rectangle představuje rozměry úchytu glyph.

Příklady

Následující příklad kódu ukazuje použití DrawFocusRectangle metody a Control.Handle vlastnosti. Pokud chcete tento příklad spustit, vložte do formuláře následující kód. Přidejte dvě tlačítka s názvem Button1 a Button2 do formuláře a ujistěte se, že jsou všechny události připojené ke svým obslužným rutinám událostí.

// 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

Poznámky

Obdélník fokusu je tečkovaný obdélník, který Windows používá k označení toho, jaký ovládací prvek má aktuální fokus klávesnice.

Platí pro