Cursor.Position Cursor.Position Cursor.Position Cursor.Position Property

정의

커서의 위치를 가져오거나 설정합니다.Gets or sets the cursor's 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입니다.A Point that represents the cursor's position in screen coordinates.

예제

다음 코드 예제에서 커서를 만들고 합니다 Current 커서의 Handle, 해당 위치 및 클리핑 사각형을 변경 합니다.The following code example creates a cursor from the Current cursor's Handle, changes its position and clipping rectangle. 결과 위쪽과 왼쪽된 50 픽셀 위치에서 코드를 실행할 때 커서가 이동 합니다.The result is the cursor will move up and to the left 50 pixels from where it is when the code is executed. 또한 커서의 클리핑 사각형 폼의 경계를 변경 됩니다 (기본적으로는 사용자의 전체 화면).Additionally, the cursor's clipping rectangle is changed to the bounds of the form (by default it is the user's whole screen). 이 예제는 FormButton 를 클릭할 때이 코드를 호출 합니다.This example requires a Form and a Button to call this code when it is clicked.

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 속성입니다.The Position property is identical to the Control.MousePosition property.

적용 대상

추가 정보