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

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > MouseEventArgs.Button プロパティの意味・解説 

MouseEventArgs.Button プロパティ

マウスのどのボタン押されたかを示す値を取得します

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

Dim instance As MouseEventArgs
Dim value As MouseButtons

value = instance.Button
public MouseButtons Button { get; }
public:
property MouseButtons Button {
    MouseButtons get ();
}
/** @property */
public MouseButtons get_Button ()

プロパティ
MouseButtons 値の 1 つ

使用例使用例

TextBox コントロールの MouseDown イベント処理してマウス右ボタンクリックするコントロール内のすべてのテキスト選択されるようにするコード例次に示します。この例では、textBox1 という名前の TextBox コントロールフォーム配置されている必要があります

Private Sub Form1_Load(ByVal
 sender As System.Object, ByVal e As
 System.EventArgs) Handles MyBase.Load
    TextBox1.ContextMenu = New ContextMenu()
End Sub

Private Sub TextBox1_MouseDown(ByVal
 sender As Object, ByVal
 e As System.Windows.Forms.MouseEventArgs) Handles TextBox1.MouseDown
    If (e.Button = Windows.Forms.MouseButtons.Right) Then
        TextBox1.Select(0, TextBox1.Text.Length)
    End If
End Sub
private void Form1_Load(object sender, EventArgs
 e)
{
    // This line suppresses the default context menu for the TextBox
 control. 
    textBox1.ContextMenu = new ContextMenu();
    textBox1.MouseDown += new MouseEventHandler(textBox1_MouseDown);
}

void textBox1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs
 e)
{
    if (e.Button == MouseButtons.Right)
    {
        textBox1.Select(0, textBox1.Text.Length);
    }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
MouseEventArgs クラス
MouseEventArgs メンバ
System.Windows.Forms 名前空間
MouseButtons 列挙
Clicks
Delta
Location


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

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

辞書ショートカット

すべての辞書の索引

「MouseEventArgs.Button プロパティ」の関連用語

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

   

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



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

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

©2025 GRAS Group, Inc.RSS