Sdílet prostřednictvím


ControlPaint.DrawFocusRectangle Metoda

Definice

Nakreslí obdélník fokusu.

Přetížení

Name Description
DrawFocusRectangle(Graphics, Rectangle, Color, Color)

Nakreslí obdélník fokusu na zadanou grafickou plochu a v zadaných mezích.

DrawFocusRectangle(Graphics, Rectangle)

Nakreslí obdélník fokusu na zadanou grafickou plochu a v zadaných mezích.

DrawFocusRectangle(Graphics, Rectangle, Color, Color)

Zdroj:
ControlPaint.cs
Zdroj:
ControlPaint.cs
Zdroj:
ControlPaint.cs
Zdroj:
ControlPaint.cs
Zdroj:
ControlPaint.cs

Nakreslí obdélník fokusu na zadanou grafickou plochu a v zadaných mezích.

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

Nakreslit Graphics .

rectangle
Rectangle

Představuje Rectangle 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 s názvem Button1 a Button2 a zajistěte, aby všechny události byly připojené k jejich 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ý systém Windows používá k označení, jaký ovládací prvek má aktuální fokus klávesnice.

Platí pro

DrawFocusRectangle(Graphics, Rectangle)

Zdroj:
ControlPaint.cs
Zdroj:
ControlPaint.cs
Zdroj:
ControlPaint.cs
Zdroj:
ControlPaint.cs
Zdroj:
ControlPaint.cs

Nakreslí obdélník fokusu na zadanou grafickou plochu a v zadaných mezích.

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

Nakreslit Graphics .

rectangle
Rectangle

Představuje Rectangle 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 zajistěte, aby všechny události byly připojené k jejich 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ý systém Windows používá k označení, jaký ovládací prvek má aktuální fokus klávesnice.

Platí pro