• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Forms.TreeView类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Windows.Forms.TreeView的典型用法代码示例。如果您正苦于以下问题:C# TreeView类的具体用法?C# TreeView怎么用?C# TreeView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TreeView类属于System.Windows.Forms命名空间,在下文中一共展示了TreeView类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: DirectoryScanner

 public DirectoryScanner(string directory, string key, TreeView output)
 {
     Logs.WriteLine("Инициализация сканера для '" + key + "'");
     path = directory;
     keyWord = key;
     tree = output;
 }
开发者ID:saneksem,项目名称:vm-algem-guide,代码行数:7,代码来源:DirectoryScanner.cs


示例17: AddNodesToTree

      void AddNodesToTree(TreeView tree,ServiceBusNode[] nodes)
      {
         string serviceNamespace = m_NamespaceTextBox.Text;

         if(tree.Nodes[0].Text == "Unspecified Namespace")
         {
            tree.Nodes.Clear();
         }
         else
         {
            foreach(TreeNode domianNode in tree.Nodes)
            {
               if(domianNode.Text == serviceNamespace)
               {
                  tree.Nodes.Remove(domianNode);
                  break;
               }
            }
         }
         TreeNode newNamespaceNode = new NamespaceTreeNode(this,serviceNamespace);
         tree.Nodes.Add(newNamespaceNode);

         tree.SelectedNode = newNamespaceNode;
         tree.Focus();

         foreach(ServiceBusNode node in nodes)
         {
            AddNode(newNamespaceNode,node);
         }
      }
开发者ID:ittray,项目名称:LocalDemo,代码行数:30,代码来源:ExplorerForm.cs


示例18: fillTree

        private void fillTree(TreeView tv)
        {
            DirectoryInfo directory;
            string sCurPath = ""; // 重新清空
            tv.Nodes.Clear();

            // 将硬盘上的所有的驱动器都列举出来
               // foreach (char c in driveLetters)
            {
               // sCurPath = c + ":\\";
                sCurPath = System.AppDomain.CurrentDomain.BaseDirectory + @"Data\";
                //Console.WriteLine("{0}",sCurPath);
                try
                {
                    // 获得该路径的目录信息
                    directory = new DirectoryInfo(sCurPath);

                    // 如果获得的目录信息正确,则将它添加到目录树视中
                    if (directory.Exists == true)
                    {
                        TreeNode newNode = new TreeNode(directory.FullName);
                        tv.Nodes.Add(newNode); // 添加新的节点到根节点
                        getSubDirs(newNode);
                        // 调用getSubDirs()函数,检查该驱动器上的任何存在子目录
                    }
                }
                catch (Exception doh)
                {
                    Console.WriteLine(doh.Message);
                }
            }
        }
开发者ID:unix8net,项目名称:ZigbeePro,代码行数:32,代码来源:FileView.cs


示例19: EditValue

        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            editorService = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
              if (editorService == null)
            return value;

              FmodEventShape Shape = context.Instance as FmodEventShape;
              System.Diagnostics.Debug.Assert(Shape != null, "EventGroupSelectionEditor only valid for FmodEventShapes!");

              // Create a TreeView and populate it
              treeView = new TreeView();
              treeView.ImageList = EditorManager.GUI.ShapeTreeImages.ImageList;
              treeView.Bounds = new Rectangle(0, 0, 400, 500);
              treeView.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeView_NodeMouseClick);
              FmodManaged.ManagedModule.GetEventGroupTree(Shape.EventProject, treeView);
              treeView.ExpandAll();

              // Show our listbox as a DropDownControl.
              // This methods returns, when the DropDownControl is closed.
              editorService.DropDownControl(treeView);

              TreeNode selectedNode = treeView.SelectedNode;
              if (selectedNode != null)
              {
            string fullPath = selectedNode.FullPath;
            return fullPath.Replace("\\", "/");
              }
              else
            return Shape.EventGroup;
        }
开发者ID:romance-ii,项目名称:projectanarchy,代码行数:30,代码来源:FmodEventShape.cs


示例20: FindNodeByText

        // �ڽڵ��������Ѱ�����ض����ֵĶ���
        public static TreeNode FindNodeByText(TreeView tree,
            TreeNode parent,
            string strText)
        {
            if (parent != null)
            {
                for (int i = 0; i < parent.Nodes.Count; i++)
                {
                    TreeNode node = parent.Nodes[i];
                    if (node.Text == strText)
                        return node;
                }

                return null;
            }
            else
            {
                if (tree == null)
                {
                    throw (new Exception("��parent����Ϊ�յ�ʱ��tree��������Ϊ��"));
                }

                for (int i = 0; i < tree.Nodes.Count; i++)
                {
                    TreeNode node = tree.Nodes[i];
                    if (node.Text == strText)
                        return node;
                }

                return null;
            }
        }
开发者ID:renyh1013,项目名称:dp2weixin,代码行数:33,代码来源:TreeViewUtil.cs



注:本文中的System.Windows.Forms.TreeView类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Forms.TreeViewCancelEventArgs类代码示例发布时间:2022-05-26
下一篇:
C# Forms.TreeNodeMouseClickEventArgs类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap