Screen.FromPoint メソッドとは? わかりやすく解説

Screen.FromPoint メソッド

指定したポイント保持するディスプレイを表す Screen取得します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

使用例使用例

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");
}
private:
   void Form1_MouseDown( Object^ /*sender*/, System::Windows::Forms::MouseEventArgs^
 e )
   {
      Point p = 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" );
      }
private void Form1_MouseDown(Object sender,
 System.Windows.Forms.
    MouseEventArgs e)
{
    Point p = new Point(e.get_X(), e.get_Y());
    Screen s = Screen.FromPoint(p);

    if (s.get_Primary()) {
        MessageBox.Show("You clicked the primary screen");
    }
    else {
        MessageBox.Show("This isn't the primary screen");
    }
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からScreen.FromPoint メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からScreen.FromPoint メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からScreen.FromPoint メソッド を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

Screen.FromPoint メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Screen.FromPoint メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS