当前位置: 首页>>代码示例>>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;未经允许,请勿转载。