ControlPaint.DrawFocusRectangle 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
绘制聚焦框。
重载
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)
参数
示例
下面的代码示例演示如何使用 DrawFocusRectangle 方法和 Control.Handle 属性。 若要运行此示例,请将以下代码粘贴到窗体中。 将两个命名 Button1
按钮和 Button2 添加到窗体,并确保所有事件都连接到其事件处理程序。
// 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)
参数
示例
下面的代码示例演示如何使用 DrawFocusRectangle 方法和 Control.Handle 属性。 若要运行此示例,请将以下代码粘贴到窗体中。 添加两个命名Button1``Button2
按钮和窗体,并确保所有事件都连接到其事件处理程序。
// 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用于指示具有当前键盘焦点的控件。