Cursors.Hand プロパティとは? わかりやすく解説

Cursors.Hand プロパティ

Web リンクの上マウス移動する表示されるハンド カーソル取得します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

使用例使用例

派生クラスで 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
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「Cursors.Hand プロパティ」の関連用語

Cursors.Hand プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Cursors.Hand プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS