Control.FromHandle(IntPtr) Control.FromHandle(IntPtr) Control.FromHandle(IntPtr) Control.FromHandle(IntPtr) Method

定义

返回当前与指定句柄关联的控件。Returns the control that is currently associated with the specified handle.

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

参数

handle
IntPtr IntPtr IntPtr IntPtr

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

返回

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

注解

使用FromChildHandle方法如果您需要返回拥有多个句柄的控件。Use the FromChildHandle method if you need to return controls that own more than one handle.

安全性

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

适用于

另请参阅