Il presente articolo è stato tradotto manualmente. Passare il puntatore sulle frasi nell'articolo per visualizzare il testo originale.
Traduzione
Originale
Questo argomento non è stato ancora valutato - Valuta questo argomento

Proprietà Cursors.Hand

Ottiene il cursore a forma di mano, visualizzato in genere quando si passa il mouse su un collegamento Web.

Spazio dei nomi:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)
public static Cursor Hand { get; }

Valore proprietà

Tipo: System.Windows.Forms.Cursor
Oggetto Cursor che rappresenta il cursore a forma di mano.

Nell'esempio di codice riportato di seguito viene illustrato come eseguire l'override del metodo Control.OnMouseHover in una classe derivata e utilizzando la proprietà Hand. Per eseguire l'esempio, incollare il codice riportato di seguito in un nuovo form e incollare questa classe, formando lo stesso file, dopo il form. Aggiungere un pulsante di tipo FunButton al form.


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 cursor the Hand cursor when the mouse moves 
		// over the button.
		Cursor = Cursors.Hand;

		// Call MyBase.OnMouseMove to activate the delegate.
		base.OnMouseMove(e);
	}


.NET Framework

Supportato in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supportato in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 o versione successiva, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (componenti di base del server non supportati), Windows Server 2008 R2 (componenti di base del server supportati con SP1 o versione successiva), Windows Server 2003 SP2

.NET Framework non supporta tutte le versioni di ciascuna piattaforma. Per un elenco delle versioni supportate, vedere Requisiti di sistema di .NET Framework.
Il documento è risultato utile?
(1500 caratteri rimanenti)

Aggiunte alla community

AGGIUNGI
© 2013 Microsoft. Tutti i diritti riservati.