Cursor.Handle Proprietà

Definizione

Ottiene il punto di controllo del cursore.

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

Valore della proprietà

IntPtr

nativeint

Oggetto IntPtr che rappresenta il punto di controllo del cursore.

Eccezioni

Il valore dell'handle è Zero.

Esempio

L'esempio Handledi codice seguente crea un cursore dal Current cursore , modifica la posizione e il rettangolo di ritaglio. Il risultato è che il cursore si sposta verso l'alto e verso sinistra 50 pixel da dove si trova quando viene eseguito il codice. Inoltre, il rettangolo di ritaglio del cursore viene modificato nei limiti del modulo (per impostazione predefinita è l'intero schermo dell'utente). In questo esempio è necessario un Form oggetto e Button per chiamare questo codice quando viene fatto clic.

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

Commenti

Non è una copia dell'handle; non eliminarlo.

Si applica a

Vedi anche