ItemDragEventArgs クラス

定義

ItemDrag コントロールと ListView コントロールの TreeView イベントのデータを提供します。

public ref class ItemDragEventArgs : EventArgs
[System.Runtime.InteropServices.ComVisible(true)]
public class ItemDragEventArgs : EventArgs
public class ItemDragEventArgs : EventArgs
[<System.Runtime.InteropServices.ComVisible(true)>]
type ItemDragEventArgs = class
    inherit EventArgs
type ItemDragEventArgs = class
    inherit EventArgs
Public Class ItemDragEventArgs
Inherits EventArgs
継承
ItemDragEventArgs
属性

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

完全な例については、リファレンス トピックを TreeView.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
      
      // 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.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 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

注釈

イベントは ItemDrag 、ユーザーが項目のドラッグを開始したときに発生します。 オブジェクトは ItemDragEventArgs 、押されたマウス ボタンを指定します。

コンストラクター

ItemDragEventArgs(MouseButtons)

マウス ボタンを指定して、ItemDragEventArgs クラスの新しいインスタンスを初期化します。

ItemDragEventArgs(MouseButtons, Object)

マウス ボタン、およびドラッグされている項目を指定して、ItemDragEventArgs クラスの新しいインスタンスを初期化します。

プロパティ

Button

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

Item

ドラッグされている項目を取得します。

メソッド

Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

適用対象