Control.FromChildHandle(IntPtr) Control.FromChildHandle(IntPtr) Control.FromChildHandle(IntPtr) Control.FromChildHandle(IntPtr) Method

定义

检索包含指定句柄的控件。Retrieves the control that contains the specified handle.

public:
 static System::Windows::Forms::Control ^ FromChildHandle(IntPtr handle);
public static System.Windows.Forms.Control FromChildHandle (IntPtr handle);
static member FromChildHandle : nativeint -> System.Windows.Forms.Control
Public Shared Function FromChildHandle (handle As IntPtr) As Control

参数

handle
IntPtr IntPtr IntPtr IntPtr

要搜索的窗口句柄 (HWND)。The window handle (HWND) to search for.

返回

Control,它表示与指定句柄关联的控件;如果找不到带有指定句柄的控件,就返回 nullThe Control that represents the control associated with the specified handle; returns null if no control with the specified handle is found.

注解

此方法搜索窗口句柄父链,直到它找到与控件关联的句柄。This method searches up the window handle parent chain until it finds a handle that is associated with a control. 此方法是比更可靠FromHandle方法,因为它将正确返回拥有多个句柄的控件。This method is more reliable than the FromHandle method, because it correctly returns controls that own more than one handle.

安全性

UIPermission
若要调用此方法的所有窗口。for all windows to call this method. 关联枚举:AllWindows的值UIPermissionWindowAssociated enumeration: AllWindows value of UIPermissionWindow.

适用于

另请参阅