다음을 통해 공유


Cursors.Hand 속성

일반적으로 웹 링크를 가리킬 때 사용되는 손 모양 커서를 가져옵니다.

네임스페이스: System.Windows.Forms
어셈블리: System.Windows.Forms(system.windows.forms.dll)

구문

‘선언
Public Shared ReadOnly Property Hand As Cursor
‘사용 방법
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

속성 값

손 모양 커서를 나타내는 Cursor입니다.

예제

다음 코드 예제에서는 파생 클래스의 Control.OnMouseHover 메서드를 재정의하고 Hand 속성을 사용하는 방법을 보여 줍니다. 이 예제를 실행하려면 새 폼에 다음 코드를 붙여넣고 이 클래스를 붙여넣어 해당 폼 다음에 동일한 파일을 만듭니다. 그런 다음 FunButton 유형의 단추를 폼에 추가합니다.

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

플랫폼

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

참고 항목

참조

Cursors 클래스
Cursors 멤버
System.Windows.Forms 네임스페이스
Cursor 클래스