Cursor.Handle Eigenschaft
Definition
Wichtig
Einige Informationen beziehen sich auf Vorabversionen, die vor dem Release ggf. grundlegend überarbeitet werden. Microsoft übernimmt hinsichtlich der hier bereitgestellten Informationen keine Gewährleistungen, seien sie ausdrücklich oder konkludent.
Ruft den Handle des Cursors ab.
public:
property IntPtr Handle { IntPtr get(); };
public IntPtr Handle { get; }
member this.Handle : nativeint
Public ReadOnly Property Handle As IntPtr
Eigenschaftswert
nativeint
Ein IntPtr Ziehpunkt, der den Cursorziehpunkt darstellt.
Ausnahmen
Beispiele
Im folgenden Codebeispiel wird ein Cursor aus dem Current Cursor Handleerstellt, dessen Position und das Beschneidungsrechteck geändert. Das Ergebnis ist, dass der Cursor nach oben und nach links 50 Pixel bewegt wird, von wo aus der Code ausgeführt wird. Darüber hinaus wird das Beschneidungsrechteck des Cursors in die Grenzen des Formulars geändert (standardmäßig ist es der gesamte Bildschirm des Benutzers). In diesem Beispiel wird ein Form und ein Button Code aufgerufen, wenn darauf geklickt wird.
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
Hinweise
Dies ist keine Kopie des Handles; entsorgen Sie sie nicht.