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

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

ItemDragEventArgs.Button プロパティ

ドラッグ操作中に押されマウス ボタンを示す値を取得します

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

Dim instance As ItemDragEventArgs
Dim value As MouseButtons

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

プロパティ
MouseButtons 値のビットごとの組み合わせ

解説解説
使用例使用例

TreeView コントロール内のドラッグ アンド ドロップ操作有効な場合の ItemDragEventArgs クラス使用例次に示しますドラッグしたノードドラッグ先に移動されるコピーされるかは、Button プロパティによって決まります次にItem プロパティによって表されているノードが、ドラッグ アンド ドロップ操作による期待した効果を示す値と共に TreeView コントロールの DoDragDrop メソッド渡されます。

詳細については、TreeView.ItemDrag のリファレンス トピック参照してください

Private Sub treeView1_ItemDrag(ByVal
 sender As Object, ByVal
 e As ItemDragEventArgs)

    ' Move the dragged node when the left mouse button is used.
    If e.Button = MouseButtons.Left Then
        DoDragDrop(e.Item, DragDropEffects.Move)

    ' Copy the dragged node when the right mouse button is used.
    ElseIf e.Button = MouseButtons.Right Then
        DoDragDrop(e.Item, DragDropEffects.Copy)
    End If
End Sub 'treeView1_ItemDrag
private void treeView1_ItemDrag(object sender,
 ItemDragEventArgs e)
{
    // Move the dragged node when the left mouse button is used.
    if (e.Button == MouseButtons.Left)
    {
        DoDragDrop(e.Item, DragDropEffects.Move);
    }

    // Copy the dragged node when the right mouse button is used.
    else if (e.Button == MouseButtons.Right)
    {
        DoDragDrop(e.Item, DragDropEffects.Copy);
    }
}
private:
   void treeView1_ItemDrag( Object^ /*sender*/, ItemDragEventArgs^
 e )
   {
      
      // Move the dragged node when the left mouse button is used.
      if ( e->Button == ::MouseButtons::Left )
      {
         DoDragDrop( e->Item, DragDropEffects::Move );
      }
      // Copy the dragged node when the right mouse button is used.
      else
      
      // Copy the dragged node when the right mouse button is used.
      if ( e->Button == ::MouseButtons::Right )
      {
         DoDragDrop( e->Item, DragDropEffects::Copy );
      }
   }
private void treeView1_ItemDrag(Object sender,
 ItemDragEventArgs e)
{
    // Move the dragged node when the left mouse button is used.
    if (e.get_Button().Equals(get_MouseButtons().Left)) {
        DoDragDrop(e.get_Item(), DragDropEffects.Move);
    }
    // Copy the dragged node when the right mouse button is used.
    else {
        if (e.get_Button().Equals(get_MouseButtons().Right)) {
            DoDragDrop(e.get_Item(), DragDropEffects.Copy);
        }
    }
} //treeView1_ItemDrag
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


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

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

辞書ショートカット

すべての辞書の索引

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

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

   

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



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

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

©2025 GRAS Group, Inc.RSS