Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Ruft den Handcursor ab, der üblicherweise beim Zeigen auf einen Webhyperlink verwendet wird.
Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)
Syntax
'Declaration
Public Shared ReadOnly Property Hand As Cursor
'Usage
Dim value As Cursor
value = Cursors.Hand
public static Cursor Hand { get; }
public:
static property Cursor^ Hand {
Cursor^ get ();
}
/** @property */
public static Cursor get_Hand ()
public static function get Hand () : Cursor
Eigenschaftenwert
Der Cursor, der den Handcursor darstellt.
Beispiel
Im folgenden Codebeispiel wird das Überschreiben der Control.OnMouseHover-Methode und der Hand-Methode in einer abgeleiteten Klasse veranschaulicht. Fügen Sie zum Ausführen des Beispiels den folgenden Code in ein neues Formular ein, und fügen Sie diese Klasse in derselben Datei nach dem Formular ein. Fügen Sie im Formular eine Schaltfläche vom Typ FunButton hinzu.
Public Class FunButton
Inherits Button
Protected Overrides Sub OnMouseHover(ByVal e As System.EventArgs)
' Get the font size in Points, add one to the
' size, and reset the button's font to the larger
' size.
Dim fontSize As Single = Font.SizeInPoints
fontSize += 1
Dim buttonSize As System.Drawing.Size = Size
Me.Font = New System.Drawing.Font _
(Font.FontFamily, fontSize, Font.Style)
' Increase the size width and height of the button
' by 5 points each.
Size = New System.Drawing.Size _
(Size.Width + 5, Size.Height + 5)
' Call myBase.OnMouseHover to activate the delegate.
MyBase.OnMouseHover(e)
End Sub
Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
' Make the curser the Hand curser when the mouse moves
' over the button.
Cursor = Cursors.Hand
' Call MyBase.OnMouseHover to activate the delegate.
MyBase.OnMouseHover(e)
End Sub
public class FunButton:
Button
{
protected override void OnMouseHover(System.EventArgs e)
{
// Get the font size in Points, add one to the
// size, and reset the button's font to the larger
// size.
float fontSize = Font.SizeInPoints;
fontSize += 1;
System.Drawing.Size buttonSize = Size;
this.Font = new System.Drawing.Font(
Font.FontFamily, fontSize, Font.Style);
// Increase the size width and height of the button
// by 5 points each.
Size = new System.Drawing.Size(Size.Width+5, Size.Height+5);
// Call myBase.OnMouseHover to activate the delegate.
base.OnMouseHover(e);
}
protected override void OnMouseMove(MouseEventArgs e)
{
// Make the curser the Hand curser when the mouse moves
// over the button.
Cursor = Cursors.Hand;
// Call MyBase.OnMouseHover to activate the delegate.
base.OnMouseHover(e);
}
// To use this example create a new form and paste this class
// forming the same file, after the form class in the same file.
// Add a button of type FunButton to the form.
public ref class FunButton: public Button
{
protected:
virtual void OnMouseHover( System::EventArgs^ e ) override
{
// Get the font size in Points, add one to the
// size, and reset the button's font to the larger
// size.
float fontSize = Font->SizeInPoints;
fontSize += 1;
System::Drawing::Size buttonSize = Size;
this->Font = gcnew System::Drawing::Font( Font->FontFamily,fontSize,Font->Style );
// Increase the size width and height of the button
// by 5 points each.
Size = System::Drawing::Size( Size.Width + 5, Size.Height + 5 );
// Call myBase.OnMouseHover to activate the delegate.
Button::OnMouseHover( e );
}
virtual void OnMouseMove( MouseEventArgs^ e ) override
{
// Make the curser the Hand curser when the mouse moves
// over the button.
Cursor = Cursors::Hand;
// Call MyBase.OnMouseHover to activate the delegate.
Button::OnMouseHover( e );
}
public class FunButton extends Button
{
protected void OnMouseHover(System.EventArgs e)
{
// Get the font size in Points, add one to the
// size, and reset the button's font to the larger
// size.
float fontSize = get_Font().get_SizeInPoints();
fontSize += 1;
System.Drawing.Size buttonSize = get_Size();
this.set_Font(new System.Drawing.Font(get_Font().get_FontFamily(),
fontSize, get_Font().get_Style()));
// Increase the size width and height of the button
// by 5 points each.
set_Size(new System.Drawing.Size(get_Size().get_Width() + 5,
get_Size().get_Height() + 5));
// Call myBase.OnMouseHover to activate the delegate.
super.OnMouseHover(e);
} //OnMouseHover
protected void OnMouseMove(MouseEventArgs e)
{
// Make the curser the Hand curser when the mouse moves
// over the button.
set_Cursor(Cursors.get_Hand());
// Call MyBase.OnMouseHover to activate the delegate.
super.OnMouseHover(e);
} //OnMouseMove
Plattformen
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
Siehe auch
Referenz
Cursors-Klasse
Cursors-Member
System.Windows.Forms-Namespace
Cursor-Klasse