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

que IntPtr representa el identificador del cursor.

Excepciones

El valor de identificador es Zero.

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 un Form elemento y un Button para 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