Gets the window handle that the control is bound to.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Syntax . . :: . IntPtr
An IntPtr that contains the window handle (HWND) of the control.
. . :: . Handle
<BrowsableAttribute(False)> _
Public ReadOnly Property Handle As IntPtr[BrowsableAttribute(false)]
public IntPtr Handle { get; }[BrowsableAttribute(false)]
public:
virtual property IntPtr Handle {
IntPtr get () sealed;
}[<BrowsableAttribute(false)>]
abstract Handle : IntPtr
[<BrowsableAttribute(false)>]
override Handle : IntPtrProperty Value
Type: SystemAn IntPtr that contains the window handle (HWND) of the control.
Implements
IWin32Window Examples
The following code example demonstrates using the ControlPaint
' 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
// 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.
void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ )
{
ControlPaint::DrawFocusRectangle( Graphics::FromHwnd( Button2->Handle ), Button2->ClientRectangle );
}
Platforms
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.