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 를 검색할 위치를 지정하는 A입니다Screen.

반품

Screen 점이 포함된 디스플레이의 A입니다. 표시에 점이 포함되지 않은 여러 디스플레이 환경에서는 지정된 지점에 가장 가까운 디스플레이가 반환됩니다.

예제

다음 코드 예제에서는 메서드를 사용 하는 방법을 보여 있습니다 FromPoint . 다음은 참조하는 Point 참조 및 X 좌표를 Y만든 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

적용 대상

추가 정보