Cursor.Handle Proprietà
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Ottiene l'handle 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à
nativeint
Oggetto IntPtr che rappresenta l'handle del cursore.
Eccezioni
Esempio
Nell'esempio Currentdi codice seguente viene creato un cursore dal Handle cursore , viene modificata la posizione e il rettangolo di ritaglio. Il risultato è che il cursore verrà spostato 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 form (per impostazione predefinita è l'intero schermo dell'utente). Questo esempio richiede un Form oggetto e un 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 si tratta di una copia dell'handle; non eliminarlo.