Cursor.Handle Proprietà
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 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
nativeint
Oggetto IntPtr che rappresenta il punto di controllo del cursore.
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
Non è una copia dell'handle; non eliminarlo.
Prodotto | Versioni |
---|---|
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9, 10 |
Feedback su .NET
.NET è un progetto di open source. Selezionare un collegamento per fornire feedback: