Screen.FromPoint(Point) 메서드

정의

지정된 위치를 포함하는 디스플레이의 Screen을 검색합니다.

public:
 static System::Windows::Forms::Screen ^ FromPoint(System::Drawing::Point point);
public static System.Windows.Forms.Screen FromPoint (System.Drawing.Point point);
static member FromPoint : System.Drawing.Point -> System.Windows.Forms.Screen
Public Shared Function FromPoint (point As Point) As Screen

매개 변수

point
Point

Point을 검색할 위치를 지정하는 Screen입니다.

반환

해당 위치를 포함하는 디스플레이에 대한 Screen입니다. 어떠한 디스플레이에도 해당 위치가 포함되어 있지 않은 여러 디스플레이 환경에서는 지정된 위치에 가장 가까운 디스플레이가 반환됩니다.

예제

다음 코드 예제에서는 FromPoint 메서드를 사용하는 방법을 보여 줍니다. 만드는이 예제는 Point 참조를 XY 좌표 전달한를 MouseEventArgs를 사용 하 여는 FromPoint 주 화면에는 점을 클릭 한 경우 확인 하는 방법.

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.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 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

적용 대상

추가 정보