Cursor.Clip Propiedad

Definición

Obtiene o establece los límites que representan el rectángulo de recorte del cursor.

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

Valor de propiedad

Rectangle que representa el rectángulo de recorte para , Cursoren coordenadas de pantalla.

Ejemplos

En el Current ejemplo de código siguiente se crea un cursor a partir del Handlecursor , se cambia su posición y se recorta el rectángulo. El resultado es que el cursor se moverá hacia arriba y a la izquierda de 50 píxeles desde donde se ejecuta el código. Además, el rectángulo de recorte del cursor se cambia a los límites del formulario (de forma predeterminada es toda la pantalla del usuario). En este ejemplo se requiere que tenga un Form elemento y un Button para llamar a este código cuando se haga clic en él.

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

Comentarios

Solo se permite mover un cursor recortado dentro de su rectángulo de recorte. Por lo general, el sistema solo permite esto si el mouse está capturado actualmente. Si el cursor no se recorta actualmente, el rectángulo resultante contiene las dimensiones de toda la pantalla.

Se aplica a