TreeViewAction 列挙型

定義

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

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

フィールド

ByKeyboard 1

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

ByMouse 2

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

Collapse 3

イベントは、TreeNode が折りたたまれたことによって発生しました。

Expand 4

イベントは、TreeNode が展開されたことによって発生しました。

Unknown 0

イベントを発生させたアクションは不明です。

次のコード例では、 イベントと 列挙型を使用する 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 メンバーによって使用されます。

適用対象

こちらもご覧ください