IWin32Window.Handle 属性
获取由实施者表示的窗口句柄。
**命名空间:**System.Windows.Forms
**程序集:**System.Windows.Forms(在 system.windows.forms.dll 中)
语法
声明
ReadOnly Property Handle As IntPtr
用法
Dim instance As IWin32Window
Dim value As IntPtr
value = instance.Handle
IntPtr Handle { get; }
property IntPtr Handle {
IntPtr get ();
}
/** @property */
IntPtr get_Handle ()
function get Handle () : IntPtr
属性值
由实施者表示的窗口句柄。
备注
取决于实施者,Handle 属性的值可以在窗口的生存期中更改。
示例
下面的示例将 label1
的 Text 属性设置为 Form1
的当前 Handle。此示例假定有一个名为 Form1
的 Form,它的上面有一个名为 label1
的 Label。
Public Sub New()
InitializeComponent()
Me.label1.Text = Me.Handle.ToString()
End Sub
public Form1()
{
InitializeComponent();
this.label1.Text = this.Handle.ToString();
}
public:
Form1()
{
InitializeComponent();
this->label1->Text = this->Handle.ToString();
}
public Form1()
{
InitializeComponent();
this.label1.set_Text(this.get_Handle().ToString());
} //Form1
平台
Windows 98、Windows 2000 SP4、Windows CE、Windows Millennium Edition、Windows Mobile for Pocket PC、Windows Mobile for Smartphone、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition
.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求。
版本信息
.NET Framework
受以下版本支持:2.0、1.1、1.0