Control.Handle Özellik

Tanım

Denetimin bağlı olduğu pencere tutamacını alır.

public:
 property IntPtr Handle { IntPtr get(); };
[System.ComponentModel.Browsable(false)]
public IntPtr Handle { get; }
[<System.ComponentModel.Browsable(false)>]
member this.Handle : nativeint
Public ReadOnly Property Handle As IntPtr

Özellik Değeri

IntPtr

nativeint

IntPtr Denetimin pencere tutamacını (HWND) içeren.

Uygulamalar

Öznitelikler

Örnekler

Aşağıdaki kod örneği ve ControlPaint.DrawFocusRectangle özelliğinin kullanılmasını Handle gösterir. Örneği çalıştırmak için aşağıdaki kodu bir forma yapıştırın. forma ve Button1 adlı Button2 iki düğme ekleyin ve tüm olayların olay işleyicilerine bağlı olduğundan emin olun.

// 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

Açıklamalar

özelliğinin Handle değeri bir Windows HWNDdeğeridir. Tanıtıcı henüz oluşturulmadıysa, bu özelliğe başvurulması tanıtıcının oluşturulmasını zorlar.

Şunlara uygulanır

Ayrıca bkz.