Cursor.Position 속성

정의

커서의 위치를 가져오거나 설정합니다.

public:
 static property System::Drawing::Point Position { System::Drawing::Point get(); void set(System::Drawing::Point value); };
public static System.Drawing.Point Position { get; set; }
member this.Position : System.Drawing.Point with get, set
Public Shared Property Position As Point

속성 값

Point

화면 좌표에서 커서의 위치를 나타내는 Point입니다.

예제

다음 코드 예제에서는 커서Handle에서 커서를 Current 만들고 위치를 변경하고 사각형을 클리핑합니다. 그 결과 커서가 코드가 실행될 때 커서가 왼쪽 50픽셀 위로 이동합니다. 또한 커서의 클리핑 사각형은 양식의 범위로 변경됩니다(기본적으로 사용자의 전체 화면임). 이 예제를 클릭할 때 이 코드를 호출하려면 a Form 와 a Button 가 필요합니다.

void MoveCursor()
{
   // Set the Current cursor, move the cursor's Position,
   // and set its clipping rectangle to the form.

   this->Cursor = gcnew System::Windows::Forms::Cursor( ::Cursor::Current->Handle );
   ::Cursor::Position = Point(::Cursor::Position.X - 50,::Cursor::Position.Y - 50);
   ::Cursor::Clip = Rectangle(this->Location,this->Size);

}
private void MoveCursor()
{
   // Set the Current cursor, move the cursor's Position,
   // and set its clipping rectangle to the form. 

   this.Cursor = new Cursor(Cursor.Current.Handle);
   Cursor.Position = new Point(Cursor.Position.X - 50, Cursor.Position.Y - 50);
   Cursor.Clip = new Rectangle(this.Location, this.Size);
}
Private Sub MoveCursor()
   ' Set the Current cursor, move the cursor's Position,
   ' and set its clipping rectangle to the form. 

   Me.Cursor = New Cursor(Cursor.Current.Handle)
   Cursor.Position = New Point(Cursor.Position.X - 50, Cursor.Position.Y - 50)
   Cursor.Clip = New Rectangle(Me.Location, Me.Size)
End Sub

설명

합니다 Position 속성이 동일 합니다 Control.MousePosition 속성입니다.

적용 대상

추가 정보