この記事は翻訳者によって翻訳されたものです。 記事の文章にポインターを重ねると、原文のテキストが表示されます。
訳文
原文
このトピックはまだ評価されていません - このトピックを評価する

Control.Handle プロパティ

コントロールのバインド先のウィンドウ ハンドルを取得します。

名前空間:  System.Windows.Forms
アセンブリ:  System.Windows.Forms (System.Windows.Forms.dll 内)
[BrowsableAttribute(false)]
public IntPtr Handle { get; }

プロパティ値

型: System.IntPtr
コントロールのウィンドウ ハンドル (HWND) を格納する IntPtr

実装

IWin32Window.Handle

Handle プロパティの値は Windows HWND です。 ハンドルがまだ作成されていない場合は、このプロパティを参照すると強制的にハンドルが作成されます。

ControlPaint.DrawFocusRectangle および Handle プロパティを使用したコード例を次に示します。 この例を実行するには、次のコードをフォームに貼り付けます。 そして、Button1 および Button2 という名前の 2 つのボタンをフォームに追加し、すべてのイベントを必ずそれぞれのイベント ハンドラーに関連付けます。


	// 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);
	}


.NET Framework

サポート対象: 4、3.5、3.0、2.0、1.1、1.0

.NET Framework Client Profile

サポート対象: 4、3.5 SP1

Windows 7, Windows Vista SP1 以降, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core はサポート対象外), Windows Server 2008 R2 (SP1 以降で Server Core をサポート), Windows Server 2003 SP2

.NET Framework では、各プラットフォームのすべてのバージョンはサポートしていません。 サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。
この情報は役に立ちましたか。
(残り 1500 文字)
コミュニティ コンテンツ 追加
注釈 FAQ