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

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

TreeViewEventArgs.Node プロパティ

チェックされた、展開された、折りたたまれた、または選択されツリー ノード取得します

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

Dim instance As TreeViewEventArgs
Dim value As TreeNode

value = instance.Node
public TreeNode Node { get; }
public:
property TreeNode^ Node {
    TreeNode^ get ();
}
/** @property */
public TreeNode get_Node ()

プロパティ
チェックされた、展開された、折りたたまれた、または選択された TreeNode。

使用例使用例

カスタマイズされた TreeView の例を次に示しますTreeView クラス継承することにより、このカスタム バージョンには通常の TreeView機能すべてが備わってます。ここでは、コンストラクタさまざまなプロパティ値を変更して固有の外観にします。ShowPlusMinus は false設定されるため、このカスタム コントロールは、ノードクリックされたときに展開または折りたたみ可能になるように、OnAfterSelect もオーバーライドます。

このようにしてカスタマイズしたコントロール階層全体使用できるため、一貫性のあるインターフェイス簡単に作成できるようになりますプロジェクトごとにコントロールさまざまなプロパティ指定する要はありません。

Public Class CustomizedTreeView
    Inherits TreeView

    Public Sub New()
        ' Customize the TreeView control by setting various properties.
        BackColor = System.Drawing.Color.CadetBlue
        FullRowSelect = True
        HotTracking = True
        Indent = 34
        ShowPlusMinus = False

        ' The ShowLines property must be false for the FullRowSelect
 
        ' property to work.
        ShowLines = False
    End Sub 'New


    Protected Overrides Sub
 OnAfterSelect(ByVal e As TreeViewEventArgs)
        ' Confirm that the user initiated the selection.
        ' This prevents the first node from expanding when it is
        ' automatically selected during the initialization of 
        ' the TreeView control.
        If e.Action <> TreeViewAction.Unknown Then
            If e.Node.IsExpanded Then
                e.Node.Collapse()
            Else
                e.Node.Expand()
            End If
        End If

        ' Remove the selection. This allows the same node to be
        ' clicked twice in succession to toggle the expansion state.
        SelectedNode = Nothing
    End Sub 'OnAfterSelect

End Class 'CustomizedTreeView
 
public class CustomizedTreeView : TreeView
{
    public CustomizedTreeView()
    {
        // Customize the TreeView control by setting various properties.
        BackColor = System.Drawing.Color.CadetBlue;
        FullRowSelect = true;
        HotTracking = true;
        Indent = 34;
        ShowPlusMinus = false;

        // The ShowLines property must be false for the FullRowSelect
 
        // property to work.
        ShowLines = false;
    }

    protected override void OnAfterSelect(TreeViewEventArgs
 e)
    {
        // Confirm that the user initiated the selection.
        // This prevents the first node from expanding when it is
        // automatically selected during the initialization of 
        // the TreeView control.
        if (e.Action != TreeViewAction.Unknown)
        {
            if (e.Node.IsExpanded) 
            {
                e.Node.Collapse();
            }
            else 
            {
                e.Node.Expand();
            }
        }

        // Remove the selection. This allows the same node to be
        // clicked twice in succession to toggle the expansion state.
        SelectedNode = null;
    }

}
public ref class CustomizedTreeView: public
 TreeView
{
public:
   CustomizedTreeView()
   {

      // Customize the TreeView control by setting various properties.
      BackColor = System::Drawing::Color::CadetBlue;
      FullRowSelect = true;
      HotTracking = true;
      Indent = 34;
      ShowPlusMinus = false;

      // The ShowLines property must be false for the FullRowSelect
      // property to work.
      ShowLines = false;
   }

protected:
   virtual void OnAfterSelect( TreeViewEventArgs^ e ) override
   {
      // Confirm that the user initiated the selection.
      // This prevents the first node from expanding when it is
      // automatically selected during the initialization of
      // the TreeView control.
      if ( e->Action != TreeViewAction::Unknown )
      {
         if ( e->Node->IsExpanded )
         {
            e->Node->Collapse();
         }
         else
         {
            e->Node->Expand();
         }
      }

      
      // Remove the selection. This allows the same node to be
      // clicked twice in succession to toggle the expansion state.
      SelectedNode = nullptr;
   }
};
public class CustomizedTreeView extends TreeView
{
    public CustomizedTreeView()
    {
        // Customize the TreeView control by setting various properties.
        set_BackColor(System.Drawing.Color.get_CadetBlue());
        set_FullRowSelect(true);
        set_HotTracking(true);
        set_Indent(34);
        set_ShowPlusMinus(false);
        // The ShowLines property must be false for the FullRowSelect
 
        // property to work.
        set_ShowLines(false);
    } //CustomizedTreeView

    protected void OnAfterSelect(TreeViewEventArgs
 e)
    {
        // Confirm that the user initiated the selection.
        // This prevents the first node from expanding when it is
        // automatically selected during the initialization of 
        // the TreeView control.
        if (!(e.get_Action().Equals(TreeViewAction.Unknown)))
 {
            if (e.get_Node().get_IsExpanded()) {
                e.get_Node().Collapse();
            }
            else {
                e.get_Node().Expand();
            }
        }
        // Remove the selection. This allows the same node to be
        // clicked twice in succession to toggle the expansion state.
        set_SelectedNode(null);
    } //OnAfterSelect
}//CustomizedTreeView 
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


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

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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2024 GRAS Group, Inc.RSS