Share via


Cursor.Clip Eigenschaft

Definition

Ruft die Begrenzungen ab, die das Auswahlrechteck für den Cursor darstellen, oder legt diese fest.

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

Eigenschaftswert

Rectangle

Das Rectangle in Bildschirmkoordinaten, das das Auswahlrechteck für den Cursor darstellt.

Beispiele

Im folgenden Codebeispiel wird ein Cursor aus dem Cursor Handleerstellt, die Position und das Current Clippingrechteck geändert. Das Ergebnis ist der Cursor, der nach oben und nach links 50 Pixel bewegt wird, wo es sich um die Ausführung des Codes handelt. Darüber hinaus wird das Clippingrechteck des Cursors in die Grenzen des Formulars geändert (standardmäßig ist es der gesamte Bildschirm des Benutzers). In diesem Beispiel muss ein Code aufgerufen Button werden, Form wenn er geklickt wird.

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

Hinweise

Ein geclipter Cursor darf nur innerhalb des Clipping-Rechtecks verschoben werden. Im Allgemeinen ermöglicht das System dies nur, wenn die Maus derzeit erfasst wird. Wenn der Cursor derzeit nicht geclippt ist, enthält das resultierende Rechteck die Dimensionen des gesamten Bildschirms.

Gilt für