Cursor.Handle Propiedad

Definición

Obtiene el identificador del cursor.

public:
 property IntPtr Handle { IntPtr get(); };
public IntPtr Handle { get; }
member this.Handle : nativeint
Public ReadOnly Property Handle As IntPtr

Valor de propiedad

IntPtr

nativeint

IntPtr que representa el identificador del cursor.

Excepciones

El valor del identificador es Zero.

Ejemplos

En el ejemplo de código siguiente se crea un cursor a partir de Handle, Current cambia su posición y rectángulo de recorte. El resultado es que el cursor se moverá hacia arriba y hacia 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 la pantalla completa del usuario). En este ejemplo se requiere un Form elemento y para Button llamar a este código cuando se hace 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

Esto no es una copia del identificador; no lo elimine.

Se aplica a

Consulte también