Screen.FromPoint(Point) 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
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
매개 변수
반품
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