Form.DesktopLocation プロパティ
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

Dim instance As Form Dim value As Point value = instance.DesktopLocation instance.DesktopLocation = value
/** @property */ public Point get_DesktopLocation () /** @property */ public void set_DesktopLocation (Point value)
デスクトップ上のフォームの位置を表す Point。

デスクトップ座標は、タスクバーを除外した画面の作業領域に基づきます。デスクトップの座標系は、ピクセル単位で表されます。アプリケーションが複数モニタ システムで実行されている場合、フォームの座標は、組み合わされたデスクトップの座標になります。
このプロパティを使用すると、Windows デスクトップ上の他のフォームやアプリケーションに合わせてフォームの位置を設定できます。
SetDesktopLocation メソッドを呼び出してから Show メソッドを呼び出すと、既定の位置にフォームが配置されます。この位置はオペレーティング システムによって決まります。ウィンドウの位置の詳細については、MSDN ライブラリ (http://msdn.microsoft.com/library/ja) で「Window Features」の「Window Size and Position」を参照してください。

デスクトップの左端から 100 ピクセル、上端から 100 ピクセルの位置にフォームが配置されるように、フォームの位置を設定するコード例を次に示します。この例では、メソッドがフォーム クラス内で定義されていることを前提にしています。
Public Sub MoveMyForm() ' Create a Point object that will be used as the location of the form. Dim tempPoint As New Point(100, 100) ' Set the location of the form using the Point object. DesktopLocation = tempPoint End Sub 'MoveMyForm
public void MoveMyForm() { // Create a Point object that will be used as the location of the form. Point tempPoint = new Point(100,100); // Set the location of the form using the Point object. this.DesktopLocation = tempPoint; }

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- Form.DesktopLocation プロパティのページへのリンク