Cursor.Position Eigenschap

Definitie

Hiermee haalt u de positie van de cursor op of stelt u deze in.

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

Waarde van eigenschap

Een Point die de positie van de cursor in schermcoƶrdinaten vertegenwoordigt.

Voorbeelden

In het volgende codevoorbeeld wordt een cursor gemaakt op basis van de cursor, wordt de CurrentHandlepositie gewijzigd en wordt de rechthoek voor het knippen gewijzigd. Het resultaat is dat de cursor omhoog gaat en naar links 50 pixels vanaf de locatie waar de code wordt uitgevoerd. Daarnaast wordt de rechthoek voor het knippen van de cursor gewijzigd in de grenzen van het formulier (standaard is dit het hele scherm van de gebruiker). In dit voorbeeld moet u deze code aanroepen FormButton wanneer erop wordt geklikt.

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

Opmerkingen

De Position eigenschap is identiek aan de Control.MousePosition eigenschap.

Van toepassing op

Zie ook