TreeViewAction 列挙型

定義

TreeViewEventArgs イベントを発生させたアクションを指定します。

public enum class TreeViewAction
public enum TreeViewAction
type TreeViewAction = 
Public Enum TreeViewAction
継承
TreeViewAction

フィールド

名前 説明
Unknown 0

イベントの原因となったアクションは不明です。

ByKeyboard 1

イベントはキーストロークによって発生しました。

ByMouse 2

イベントはマウス操作によって発生しました。

Collapse 3

イベントは、 TreeNode の折りたたみが原因で発生しました。

Expand 4

イベントは、 TreeNode 展開によって発生しました。

次のコード例は、 TreeView.AfterSelect イベントと TreeViewAction 列挙体を使用する方法を示しています。 この例を実行するには、TreeView1 という名前の TreeView コントロールを含むフォームに次のコードを貼り付けます。 この例では、TreeView1 に項目が設定され、 TreeView.AfterSelect イベントがサンプルで定義されているイベント処理メソッドに接続されていることを前提としています。

private:
   // Handle the After_Select event.
   void TreeView1_AfterSelect( System::Object^ /*sender*/, System::Windows::Forms::TreeViewEventArgs^ e )
   {
      
      // Vary the response depending on which TreeViewAction
      // triggered the event. 
      switch ( (e->Action) )
      {
         case TreeViewAction::ByKeyboard:
            MessageBox::Show( "You like the keyboard!" );
            break;

         case TreeViewAction::ByMouse:
            MessageBox::Show( "You like the mouse!" );
            break;
      }
   }
// Handle the After_Select event.
private void TreeView1_AfterSelect(System.Object sender, 
    System.Windows.Forms.TreeViewEventArgs e)
{

    // Vary the response depending on which TreeViewAction
    // triggered the event. 
    switch((e.Action))
    {
        case TreeViewAction.ByKeyboard:
            MessageBox.Show("You like the keyboard!");
            break;
        case TreeViewAction.ByMouse:
            MessageBox.Show("You like the mouse!");
            break;
    }
}
' Handle the After_Select event.
Private Sub TreeView1_AfterSelect(ByVal sender As System.Object, _
    ByVal e As System.Windows.Forms.TreeViewEventArgs) _
        Handles TreeView1.AfterSelect

    ' Vary the response depending on which TreeViewAction
    ' triggered the event. 
    Select Case (e.Action)
        Case TreeViewAction.ByKeyboard
            MessageBox.Show("You like the keyboard!")
        Case TreeViewAction.ByMouse
            MessageBox.Show("You like the mouse!")
    End Select
End Sub

注釈

この列挙型は、 TreeViewEventArgs コンストラクターなどのメンバーによって使用されます。

適用対象

こちらもご覧ください