The following code example demonstrates using the ControlPaint.DrawFocusRectangle and the Handle property. To run the example paste the following code in a form. Add two buttons named Button1 and Button2 to the form and ensure all events are connected to their event handlers.
// This method draws a focus rectangle on Button2 using the // handle and client rectangle of Button2. privatevoid Button1_Click(System.Object sender, System.EventArgs e)
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)