Control.Handle
Control.Handle
Control.Handle
Control.Handle
Property
Definición
Obtiene el identificador de ventana al que está enlazado el control.Gets the window handle that the control is bound to.
public:
property IntPtr Handle { IntPtr get(); };
[System.ComponentModel.Browsable(false)]
public IntPtr Handle { get; }
member this.Handle : nativeint
Public ReadOnly Property Handle As IntPtr
Valor de propiedad
IntPtr que contiene el identificador de ventana (HWND
) del control.An IntPtr that contains the window handle (HWND
) of the control.
Implementaciones
Ejemplos
En el ejemplo de código siguiente se muestra cómo utilizar el ControlPaint.DrawFocusRectangle y Handle propiedad.The following code example demonstrates using the ControlPaint.DrawFocusRectangle and the Handle property. Para ejecutar el ejemplo, pegue el código siguiente en un formulario.To run the example paste the following code in a form. Agregue dos botones denominados Button1
y Button2
al formulario y asegúrese de que todos los eventos están conectados a sus controladores de eventos.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.
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
Comentarios
El valor de la Handle propiedad es un Windows HWND
.The value of the Handle property is a Windows HWND
. Si aún no se ha creado el identificador, que hacen referencia a esta propiedad se fuerza la creación de identificador.If the handle has not yet been created, referencing this property will force the handle to be created.
Se aplica a
Consulte también:
- CreateControl() CreateControl() CreateControl() CreateControl()
- CreateHandle() CreateHandle() CreateHandle() CreateHandle()
- CreateParams CreateParams CreateParams CreateParams
- DestroyHandle() DestroyHandle() DestroyHandle() DestroyHandle()
- IsHandleCreated IsHandleCreated IsHandleCreated IsHandleCreated
- OnHandleCreated(EventArgs) OnHandleCreated(EventArgs) OnHandleCreated(EventArgs) OnHandleCreated(EventArgs)
- RecreateHandle() RecreateHandle() RecreateHandle() RecreateHandle()
- RecreatingHandle RecreatingHandle RecreatingHandle RecreatingHandle
- UpdateStyles() UpdateStyles() UpdateStyles() UpdateStyles()
Comentarios
Nos gustaría conocer su opinión. Elija el tipo que desea proporcionar:
Nuestro sistema de comentarios está basado en los problemas de GitHub. Más información en nuestro blog.
Cargando comentarios...