當前位置: 首頁>>代碼示例>>C#>>正文


C# Forms.TreeView類代碼示例

本文整理匯總了C#中System.Windows.Forms.TreeView的典型用法代碼示例。如果您正苦於以下問題:C# TreeView類的具體用法?C# TreeView怎麽用?C# TreeView使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TreeView類屬於System.Windows.Forms命名空間,在下文中一共展示了TreeView類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: loadListOfGacAssemblies

 public void loadListOfGacAssemblies(TreeView lbListOfGacAssemblies, string filter, List<IGacDll> assembliesToLoad)
 {
     this.invokeOnThread(
         () =>
         {
             tvListOfGacAssemblies.Nodes.Clear();
             foreach (var gacAssembly in assembliesToLoad)
                 if (RegEx.findStringInString(gacAssembly.name, filter))
                 {
                     var newTreeNode = new TreeNode(gacAssembly.name)
                                           {
                                               Tag = gacAssembly
                                           };
                     if (treeViewColorFilter != null && filter != "")
                         // for performance reasons only apply this when there is a filter
                         if (treeViewColorFilter(gacAssembly.fullPath))
                             // move this code to the consumers of this assembly
                             /* if (PostSharpUtils.containsO2PostSharpHooks(gacAssembly.fullPath))*/
                             newTreeNode.ForeColor = Color.DarkGreen;
                         else
                             newTreeNode.ForeColor = Color.DarkRed;
                     tvListOfGacAssemblies.Nodes.Add(newTreeNode);
                 }
         });
 }
開發者ID:pusp,項目名稱:o2platform,代碼行數:25,代碼來源:ascx_GAC_Browser.Controllers.cs

示例2: ApplyFilterEntriesToTreeView

        internal static void ApplyFilterEntriesToTreeView(TreeView treeView, IEnumerable<EntityStoreSchemaFilterEntry> filterEntriesToApply)
        {
            foreach (TreeNode parentNode in treeView.Nodes)
            {
                foreach (TreeNode schemaNode in parentNode.Nodes)
                {
                    foreach (TreeNode child in schemaNode.Nodes)
                    {
                        // Check to see if the filter entries allow this.
                        // TODO this is not very performant, but we assume a small number of filters based on our
                        // existing optimization logic for selecting the filters in the first place
                        var entryToTest = child.Tag as EntityStoreSchemaFilterEntry;
                        Debug.Assert(entryToTest != null, "entryToTest should not be null");
                        if (entryToTest != null)
                        {
                            var effect = entryToTest.GetEffectViaFilter(filterEntriesToApply);

                            // Check the resulting effect
                            if (effect == EntityStoreSchemaFilterEffect.Allow)
                            {
                                child.Checked = true;
                            }
                        }
                    }
                }
            }
        }
開發者ID:Cireson,項目名稱:EntityFramework6,代碼行數:27,代碼來源:TreeViewSchemaFilterMapper.cs

示例3: osd_screen

		public osd_screen (int num, OSD aosd)
		{
			number=num;
			osd=aosd;
			
			num+=1;
			
			this.tabPage = new System.Windows.Forms.TabPage();		
			this.panelItems=new Panel[64];
			this.panelItems_default = new Panel[64];
			this.LIST_items=new System.Windows.Forms.TreeView();
			this.rbtSortCategory = new System.Windows.Forms.RadioButton();
            this.rbtSortAlphabetic = new System.Windows.Forms.RadioButton();
			this.groupBox = new System.Windows.Forms.GroupBox();
			this.label2 = new System.Windows.Forms.Label();
            this.label1 = new System.Windows.Forms.Label();
            this.NUM_Y = new System.Windows.Forms.NumericUpDown();
            this.NUM_X = new System.Windows.Forms.NumericUpDown();
			this.pictureBox = new System.Windows.Forms.PictureBox();
			this.chkSign = new System.Windows.Forms.CheckBox();
			
			this.tabPage.SuspendLayout();
			this.groupBox.SuspendLayout();
			this.pictureBox.SuspendLayout();
		}
開發者ID:svpcom,項目名稱:minimosd-extra,代碼行數:25,代碼來源:osd_screen.cs

示例4: generateTree

 public static void generateTree(TreeView view)
 {
     List<string> list_first = getRootName();
     foreach (var first in list_first)
     {
         TreeNode firstnode = new TreeNode(first);
         List<string> list_second = getSecondName(first);
         foreach (var second in list_second)//第二層
         {
             TreeNode secondnode = new TreeNode(second);
             List<string> list_third = getThirdName(second);
             foreach (var third in list_third)//第三層
             {
                 TreeNode thirdnode = new TreeNode(third);
                 List<string> list_forth = getForthName(third);
                 foreach (var forth in list_forth)//第四層
                 {
                     TreeNode forthnode = new TreeNode(forth);
                     List<string> list_fifth = getFifthName(forth,third);
                     foreach (var fifth in list_fifth)//第五層
                     {
                         TreeNode fifthnode = new TreeNode(fifth);
                         forthnode.Nodes.Add(fifthnode);
                     }
                     thirdnode.Nodes.Add(forthnode);
                 }
                 secondnode.Nodes.Add(thirdnode);
             }
             firstnode.Nodes.Add(secondnode);
         }
         view.Nodes.Add(firstnode);
     }
 }
開發者ID:xfgxfg,項目名稱:CropWatchField,代碼行數:33,代碼來源:TreeNodeOperate.cs

示例5: DirectoryScanner

 public DirectoryScanner(string path, TreeView tree, string filePath, StatusUpdater updater, TextBox erroLogTextBox)
 {
     Path = path;
     _xmlEntryService = new XmlEntryService(filePath, erroLogTextBox);
     _treeEntryService = new TreeEntryService(tree, erroLogTextBox);
     _statusUpdater = updater;
 }
開發者ID:Henriet,項目名稱:Plarium_Threads,代碼行數:7,代碼來源:DirectoryScanner.cs

示例6: AreaTextprint

        public void AreaTextprint(TreeView DOMTreeView, TreeNode tree_node)
        {
            try
            {
                if (tree_node == null) return;      //如果沒有選取任何 TreeNode

                DOMTreeView.SelectedNode = tree_node;   //設定目前在樹狀檢視控製項中選取的樹狀節點。
                DOMTreeView.Visible = false;
                DOMTreeView.Select();     // Select() 方法會啟動此控製項。
                while (DOMTreeView .SelectedNode .Nodes .Count >1)    //如果目前沒有選取任何 TreeNode, SelectedNode 屬性為 null。
                {
                    tagname.Push(tree_node);

                    if (DOMTreeView.SelectedNode == null) return;   //如果目前沒有選取任何 TreeNode, SelectedNode 屬性為 null。

                    DOMTreeView.SelectedNode = DOMTreeView.SelectedNode.NextVisibleNode;
                    DOMTreeView.Select();
                }
                DOMTreeView.Visible = true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
開發者ID:jeok70,項目名稱:Automatic-data-processing-news,代碼行數:25,代碼來源:Global.cs

示例7: SearchForm

 public SearchForm(TreeView list)
 {
     InitializeComponent();
     this.Icon=Properties.Resources.fosnip;
     bReset.Enabled=false;
     tv=list;
 }
開發者ID:Emilgardis,項目名稱:falloutsnip,代碼行數:7,代碼來源:SearchForm.cs

示例8: N_LoadInfo

        /*
         * 外部調用
         */ 

        #region [ 方法: 加載部門,工種信息 ]

        public bool N_LoadInfo(TreeView tvDep, ComboBox cmbWorkType, int intUserType)
        {
            //加載部門
            using (ds = new DataSet())
            {
                ds = lrtdal.N_GetDeptInfo();
                if (ds != null && ds.Tables.Count > 0)
                {
                    TreeNode tnDept = new TreeNode();
                    tnDept.Text = "所有部門";
                    tnDept.Name = "0";
                    tvDep.Nodes.Add(tnDept);
                    this.N_LoadChildDept(tnDept, 0, 0, ds.Tables[0].Rows.Count);
                }
            }

            //加載工種
            using (ds = new DataSet())
            {
                ds = lrtdal.N_GetWorkTypeInfo();
                if (ds != null && ds.Tables.Count > 0)
                {
                    this.N_LoadWorkType(cmbWorkType);
                }
            }

            return true;
        }
開發者ID:ZoeCheck,項目名稱:128_5.6_2010,代碼行數:34,代碼來源:Li_RealTimeInOutStationHeadInfo_BLL.cs

示例9: SetTreeviewDirectory

        public void SetTreeviewDirectory(TreeView treeView, string path)
        {
            treeView.Nodes.Clear();

            if (path == string.Empty) return;

            try
            {
                var rootDirectoryInfo = new DirectoryInfo(path);
                treeView.Nodes.Add(CreateDirectoryNode(rootDirectoryInfo));
                treeView.Nodes[0].Expand();

                if (Properties.Settings.Default.AutoExpandTreeView)
                {
                    foreach (TreeNode node in treeView.Nodes[0].Nodes)
                    {
                        node.Expand();
                    }
                }

                // Scroll to top
                treeView.Nodes[0].EnsureVisible();
            }
            catch
            {
                MessageBox.Show("Unable to open directory");
            }
        }
開發者ID:alandoherty,項目名稱:dash-core,代碼行數:28,代碼來源:FilesHelper.cs

示例10: FillTree

 public static void FillTree(TreeView tv, string sql)
 {
     try
     {
         OracleConnection conn = new OracleConnection(DataAccess.OIDSConnStr);
         conn.Open();
         OracleCommand cmd = conn.CreateCommand();
         cmd.CommandText = sql;
         OracleDataReader dr = cmd.ExecuteReader();
         if (dr.HasRows)
         {
             while (dr.Read())
             {
                 tv.Nodes.Add(dr[0].ToString());
             }
             conn.Close();
             dr.Close();
         }
     }
     catch (OracleException ox)
     {
         MessageBox.Show(ox.Message.ToString());
         return;
     }
 }
開發者ID:freudshow,項目名稱:raffles-codes,代碼行數:25,代碼來源:FillTreeViewFunction.cs

示例11: GenerateTreeView

        private static void GenerateTreeView(TreeView treeView, IEnumerable<Files> fileList, char pathSeparator)
        {
            TreeNode lastNode = null;
            foreach (Files f in fileList)
            {

                int subPathCounter = 0;
                var subPathAgg = string.Empty;
                foreach (string subPath in f.GetTreePath().Split(pathSeparator))
                {
                    subPathCounter++;
                    subPathAgg += subPath + pathSeparator;
                    TreeNode[] nodes = treeView.Nodes.Find(subPathAgg, true);
                    if (nodes.Length == 0)
                        if (lastNode == null)
                        {
                            lastNode = treeView.Nodes.Add(subPathAgg, subPath);
                            lastNode.Text = "ROZWIN";
                        }
                        else
                        {
                            lastNode = lastNode.Nodes.Add(subPathAgg, subPath);
                        }
                    else
                    {
                        lastNode = nodes[0];
                    }
                }
            }
        }
開發者ID:mortalboy,項目名稱:Update_Manager,代碼行數:30,代碼來源:Form1.cs

示例12: DebugForm

        public DebugForm(DockBase pane)
        {
            InitializeComponent();
            property.SelectedObject = pane;
            var infoArray = new DockBaseNeigh.DireInfo[] { pane.Neigh.Top, pane.Neigh.Bottom, pane.Neigh.Left, pane.Neigh.Right };
            var strArray = new string[] { "Top", "Bottom", "Left", "Right" };
            var view = new TreeView { Dock = DockStyle.Fill };
            for (int i = 0; i < infoArray.Length; i++)
            {
                var node = new TreeNode(strArray[i]);
                var outers = new TreeNode("outers");
                var inners = new TreeNode("inner");
                foreach (var control in infoArray[i].Inners)
                    inners.Nodes.Add(control.Location + ":" + control.Size);
                foreach (var control2 in infoArray[i].Outers)
                    outers.Nodes.Add(control2.Location + ":" + control2.Size);
                node.Nodes.Add(inners);
                node.Nodes.Add(outers);

                view.Nodes.Add(node);
            }
            splitContainer1.Panel2.Controls.Add(view);
            Text = String.Format("{0}[{1}]", pane.GetType().Name, pane.Bounds.ToString());
            Show();
        }
開發者ID:namoshika,項目名稱:SnkLib.Win.Forms.DockingWindow,代碼行數:25,代碼來源:DebugForm.cs

示例13: PrintPreviewTree

 /// <summary>
 ///     Shows a PrintPreview dialog displaying the Tree control passed in.
 /// </summary>
 /// <param name="tree">TreeView to print preview</param>
 /// <param name="reportTitle"></param>
 public void PrintPreviewTree(TreeView tree, string reportTitle)
 {
     this.title = reportTitle;
     this.PrepareTreeImage(tree);
     var pp = new PrintPreviewDialog { Document = this.printDoc };
     pp.Show();
 }
開發者ID:jilamilani,項目名稱:PrintTreeView,代碼行數:12,代碼來源:PrintHelper.cs

示例14: InitializeComponent

 private void InitializeComponent()
 {
     this.tvwWarnings = new TreeView();
     this.SuspendLayout();
     this.tvwWarnings.Dock = DockStyle.Fill;
     Point point2 = new Point(0, 0);
     this.tvwWarnings.Location = point2;
     Padding padding2 = new Padding(3, 2, 3, 2);
     this.tvwWarnings.Margin = padding2;
     this.tvwWarnings.Name = "tvwWarnings";
     Size size2 = new Size(0x1ad, 0xf7);
     this.tvwWarnings.Size = size2;
     this.tvwWarnings.TabIndex = 0;
     SizeF ef2 = new SizeF(8f, 16f);
     this.AutoScaleDimensions = ef2;
     this.AutoScaleMode = AutoScaleMode.Font;
     size2 = new Size(0x1ad, 0xf7);
     this.ClientSize = size2;
     this.Controls.Add(this.tvwWarnings);
     padding2 = new Padding(3, 2, 3, 2);
     this.Margin = padding2;
     this.Name = "frmWarnings";
     this.TopMost = true;
     this.ResumeLayout(false);
 }
開發者ID:Zabanya,項目名稱:SharpFlame,代碼行數:25,代碼來源:frmWarnings.cs

示例15: Form1_Load

 private void Form1_Load(object sender, EventArgs e)
 {
     TreeView treeView1 = new TreeView();
     //
     // This is the first node in the view.
     //
     TreeNode treeNode = new TreeNode("Windows");
     treeView1.Nodes.Add(treeNode);
     //
     // Another node following the first node.
     //
     treeNode = new TreeNode("Linux");
     treeView1.Nodes.Add(treeNode);
     //
     // Create two child nodes and put them in an array.
     // ... Add the third node, and specify these as its children.
     //
     TreeNode node2 = new TreeNode("C#");
     TreeNode node3 = new TreeNode("VB.NET");
     TreeNode[] array = new TreeNode[] { node2, node3 };
     //
     // Final node.
     //
     treeNode = new TreeNode("Dot Net Perls", array);
     treeView1.Nodes.Add(treeNode);
 }
開發者ID:damy90,項目名稱:Telerik-all,代碼行數:26,代碼來源:Form1.cs


注:本文中的System.Windows.Forms.TreeView類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。