Screen.FromPoint メソッド
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

Dim point As Point Dim returnValue As Screen returnValue = Screen.FromPoint(point)
戻り値
ポイントを保持するディスプレイを表す Screen。ポイントを保持するディスプレイがない複数ディスプレイ環境では、指定したポイントに最も近いディスプレイが返されます。

FromPoint メソッドを使用する方法を次のコード例に示します。この例では、MouseEventArgs によって渡された X 座標と Y 座標を参照する Point を作成し、FromPoint メソッドを使用して、クリックされたポイントがプライマリ画面上にあるかどうかを確認します。
Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown Dim p As New System.Drawing.Point(e.X, e.Y) Dim s As System.Windows.Forms.Screen = Screen.FromPoint(p) If s.Primary = True Then MessageBox.Show("You clicked the primary screen") Else MessageBox.Show("This isn't the primary screen") End If End Sub
private void Form1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { Point p = new Point(e.X, e.Y); Screen s = Screen.FromPoint(p); if (s.Primary) { MessageBox.Show("You clicked the primary screen"); } else { MessageBox.Show("This isn't the primary screen"); }

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


Weblioに収録されているすべての辞書からScreen.FromPoint メソッドを検索する場合は、下記のリンクをクリックしてください。

- Screen.FromPoint メソッドのページへのリンク