다음을 통해 공유


Form.DesktopLocation 속성

Windows 데스크톱에서 폼의 위치를 가져오거나 설정합니다.

네임스페이스: System.Windows.Forms
어셈블리: System.Windows.Forms(system.windows.forms.dll)

구문

‘선언
Public Property DesktopLocation As Point
‘사용 방법
Dim instance As Form
Dim value As Point

value = instance.DesktopLocation

instance.DesktopLocation = value
public Point DesktopLocation { get; set; }
public:
property Point DesktopLocation {
    Point get ();
    void set (Point value);
}
/** @property */
public Point get_DesktopLocation ()

/** @property */
public void set_DesktopLocation (Point value)
public function get DesktopLocation () : Point

public function set DesktopLocation (value : Point)

속성 값

데스크톱에서 폼의 위치를 나타내는 Point입니다.

설명

데스크톱 좌표는 작업 표시줄을 제외한 화면의 작업 영역을 기반으로 합니다. 데스크톱의 좌표계는 픽셀을 단위로 합니다. 응용 프로그램이 복수 모니터 시스템에서 실행되는 경우 폼의 좌표는 조합된 데스크톱의 좌표입니다.

이 속성을 사용하여 Windows 데스크톱에서 다른 폼이나 응용 프로그램을 기준으로 폼을 배치할 수 있습니다.

Show 메서드를 호출하기 전에 SetDesktopLocation 메서드를 호출하면 운영 체제에서 결정하는 기본 위치에 폼이 배치됩니다. 창 배치에 대한 자세한 내용은 MSDN Library(https://msdn.microsoft.com/library/kor.)에 있는 "Window Features" 문서의 "Window Size and Position" 단원을 참조하십시오.

Show를 호출한 후에 SetDesktopLocation을 호출하면 사용자가 지정한 위치에 폼이 배치됩니다.

예제

다음 코드 예제에서는 폼이 데스크톱의 왼쪽 테두리 및 위쪽 테두리에서 각각 100픽셀 거리에 배치되도록 폼의 위치를 설정합니다. 이 예제에서는 폼 클래스 내에 메서드가 정의되어 있어야 합니다.

Public Sub MoveMyForm()
    ' Create a Point object that will be used as the location of the form.
    Dim tempPoint As New Point(100, 100)
    ' Set the location of the form using the Point object.
    DesktopLocation = tempPoint
End Sub 'MoveMyForm
public void MoveMyForm()
 {
    // Create a Point object that will be used as the location of the form.
    Point tempPoint = new Point(100,100);
    // Set the location of the form using the Point object.
    this.DesktopLocation = tempPoint;
 }
   
public:
   void MoveMyForm()
   {
      // Create a Point object that will be used as the location of the form.
      Point tempPoint = Point( 100, 100 );
      // Set the location of the form using the Point object.
      this->DesktopLocation = tempPoint;
   }
public void MoveMyForm()
{
    // Create a Point object that will be used as the location of 
    // the form.
    Point tempPoint = new Point(100, 100);

    // Set the location of the form using the Point object.
    this.set_DesktopLocation(tempPoint);
} //MoveMyForm

플랫폼

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에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

참고 항목

참조

Form 클래스
Form 멤버
System.Windows.Forms 네임스페이스
Form.DesktopBounds 속성