Control.OnMouseMove メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > Control.OnMouseMove メソッドの意味・解説 

Control.OnMouseMove メソッド

MouseMove イベント発生させます

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

Protected Overridable Sub
 OnMouseMove ( _
    e As MouseEventArgs _
)
Dim e As MouseEventArgs

Me.OnMouseMove(e)
protected virtual void OnMouseMove (
    MouseEventArgs e
)
protected:
virtual void OnMouseMove (
    MouseEventArgs^ e
)
protected void OnMouseMove (
    MouseEventArgs e
)
protected function OnMouseMove (
    e : MouseEventArgs
)

パラメータ

e

イベント データ格納している MouseEventArgs。

解説解説
使用例使用例

派生クラスの OnMouseHover メソッドおよび OnMouseMove メソッドオーバーライドする方法次のコード例示します。この例を実行するには、次のコード新しフォーム貼り付けて、同じファイル形成するこのクラスを、そのフォームの後に貼り付けます。そして、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
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からControl.OnMouseMove メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からControl.OnMouseMove メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からControl.OnMouseMove メソッド を検索

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

辞書ショートカット

すべての辞書の索引

「Control.OnMouseMove メソッド」の関連用語

Control.OnMouseMove メソッドのお隣キーワード
検索ランキング

   

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



Control.OnMouseMove メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS