Cursor.Position Tulajdonság

Definíció

Lekéri vagy beállítja a kurzor pozícióját.

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; }
static member Position : System.Drawing.Point with get, set
Public Shared Property Position As Point

Tulajdonság értéke

A Point kurzor pozícióját ábrázoló képernyőkoordináta.

Példák

Az alábbi példakód egy kurzort hoz létre a Current kurzorból, megváltoztatja Handlea pozícióját és a kivágási téglalapot. Az eredmény az, hogy a kurzor felfelé és balra halad 50 képponttal a kód végrehajtásakor. Emellett a kurzor kivágási téglalapja az űrlap határaira módosul (alapértelmezés szerint ez a felhasználó teljes képernyője). Ehhez a példához egy Form és egy Button kódra van szükség a kód meghívásához, amikor rákattint.

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

Megjegyzések

A Position tulajdonság megegyezik a tulajdonságával Control.MousePosition .

A következőre érvényes:

Lásd még