当前位置: 首页>>代码示例>>C#>>正文


C# TreeView.Invalidate方法代码示例

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


在下文中一共展示了TreeView.Invalidate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RefreshModTree

        void RefreshModTree(TreeView treeView, string[] modList)
        {
            treeView.Nodes.Clear();
            Dictionary<string, TreeNode> nodes;
            nodes = modList.Where(x => allMods[x].Standalone).ToDictionary(x => x, x => new TreeNode(x));
            string[] rootMods = modList.Where(x => allMods[x].Standalone).ToArray();
            string[] remaining = modList.Except(nodes.Keys).ToArray();

            while (remaining.Length > 0)
            {
                bool progress = false;
                List<string> toRemove = new List<string>();
                foreach (string s in remaining)
                {
                    var n = new TreeNode(s);
                    if (allMods[s].Requires == null) continue;
                    if (!nodes.ContainsKey(allMods[s].Requires)) continue;
                    nodes[allMods[s].Requires].Nodes.Add(n);
                    nodes.Add(s, n);
                    toRemove.Add(s);
                    progress = true;
                }

                if (!progress)
                    break;
                remaining = remaining.Except(toRemove).ToArray();
            }

            foreach (string s in rootMods)
                treeView.Nodes.Add(nodes[s]);

            if (remaining.Length > 0)
            {
                var n = new TreeNode("<Unspecified Dependency>");
                n.ForeColor = SystemColors.GrayText;
                var m = new TreeNode("<Missing Dependency>");
                m.ForeColor = SystemColors.GrayText;

                foreach (var s in remaining)
                {
                    if (allMods[s].Requires == null)
                        n.Nodes.Add(new TreeNode(s) { ForeColor = SystemColors.GrayText });
                    else if (!nodes.ContainsKey(allMods[s].Requires))
                        m.Nodes.Add(new TreeNode(s) { ForeColor = SystemColors.GrayText });
                }

                treeView.Nodes.Add(n);
                treeView.Nodes.Add(m);
            }

            treeView.Invalidate();
        }
开发者ID:geckosoft,项目名称:OpenRA,代码行数:52,代码来源:ConfigureModsDialog.cs

示例2: HandleCheckBoxNodes

//		private void UndoLastSelectedNode()
//		{
//			if (m_lastSelectedTreeNode != null)
//			{
//				if (IsTerminalNode(m_lastSelectedTreeNode))
//				{
//					m_lastSelectedTreeNode.Chosen = false;
//					m_lastSelectedTreeNode.ImageIndex = m_lastSelectedTreeNode.SelectedImageIndex = (int)ImageKind.radio;
//				}
//			}
//		}
		private void HandleCheckBoxNodes(TreeView tv, FeatureTreeNode tn)
		{
			//UndoLastSelectedNode();
			if (IsTerminalNode(tn))
			{
				tn.Chosen = true;
				tn.ImageIndex = tn.SelectedImageIndex = (int)ImageKind.radioSelected;
				if (tn.Parent != null)
				{
					FeatureTreeNode sibling = (FeatureTreeNode)tn.Parent.FirstNode;
					while (sibling != null)
					{
						if (IsTerminalNode(sibling) && sibling != tn)
						{
							sibling.Chosen = false;
							sibling.ImageIndex = sibling.SelectedImageIndex = (int)ImageKind.radio;
						}
						sibling = (FeatureTreeNode)sibling.NextNode;
					}
				}
				tv.Invalidate();
			}
//			m_lastSelectedTreeNode = tn;
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:35,代码来源:FeatureStructureTreeView.cs

示例3: RefreshModTree

        void RefreshModTree(TreeView treeView, string[] modList)
        {
            treeView.Nodes["ModsNode"].Nodes.Clear();
            Dictionary<string, TreeNode> nodes;
            nodes = modList.Where(x => allMods[x].Standalone).ToDictionary(x => x,
                x => new TreeNode(allMods[x].Title) { Name = x });
            string[] rootMods = modList.Where(x => allMods[x].Standalone).ToArray();
            Stack<string> remaining = new Stack<string>(modList.Except(nodes.Keys));

            bool progress = true;
            while (remaining.Count > 0 && progress)
            {
                progress = false;
                string s = remaining.Pop();
                var n = new TreeNode(allMods[s].Title) { Name = s };
                if (allMods[s].Requires == null) { remaining.Push(s); continue; }
                if (!nodes.ContainsKey(allMods[s].Requires)) { remaining.Push(s); continue; }
                nodes[allMods[s].Requires].Nodes.Add(n);
                nodes.Add(s, n);
                progress = true;
            }

            foreach (string s in rootMods)
                treeView.Nodes["ModsNode"].Nodes.Add(nodes[s]);

            if (remaining.Count > 0)
            {
                var unspecified = new TreeNode("<Unspecified Dependency>") { ForeColor = SystemColors.GrayText };
                var missing = new TreeNode("<Missing Dependency>") { ForeColor = SystemColors.GrayText };

                foreach (var s in remaining)
                {
                    if (allMods[s].Requires == null)
                        unspecified.Nodes.Add(new TreeNode(allMods[s].Title)
                        { ForeColor = SystemColors.GrayText, Name = s });
                    else if (!nodes.ContainsKey(allMods[s].Requires))
                        missing.Nodes.Add(new TreeNode(allMods[s].Title)
                        { ForeColor = SystemColors.GrayText, Name = s });
                }
                string brokenKey = "BrokenModsNode";
                if (treeView.Nodes[brokenKey] != null)
                    treeView.Nodes.RemoveByKey(brokenKey);
                treeView.Nodes.Add(brokenKey, "Broken Mods");
                treeView.Nodes[brokenKey].Nodes.Add(unspecified);
                treeView.Nodes[brokenKey].Nodes.Add(missing);
            }
            treeView.Nodes["ModsNode"].ExpandAll();
            treeView.Invalidate();

            string responseString = UtilityProgram.CallSimpleResponse("--settings-value", SupportDir, "Game.Mods");

            if (Util.IsError(ref responseString))
                treeView.SelectedNode = treeView.Nodes["ModsNode"].Nodes["ra"];
            else
                treeView.SelectedNode = treeView.Nodes["ModsNode"].Nodes[responseString];
        }
开发者ID:patthoyts,项目名称:OpenRA,代码行数:56,代码来源:Launcher.cs

示例4: HandleCheckBoxNodes

		protected virtual void HandleCheckBoxNodes(TreeView tv, TreeNode tn)
		{
			UndoLastSelectedNode();
			if (m_fTerminalsUseCheckBoxes)
			{
				if (IsTerminalNode(tn))
				{
					MasterInflectionFeature mif = tn.Tag as MasterInflectionFeature;
					if (tn.Checked)
					{
						if (mif == null || !mif.InDatabase)
						{
							tn.Checked = false;
							tn.ImageIndex = tn.SelectedImageIndex = (int)ImageKind.checkBox;
						}
					}
					else
					{
						tn.Checked = true;
						tn.ImageIndex = tn.SelectedImageIndex = (int)ImageKind.checkedBox;
						if (mif != null)
						{
							string sId = XmlUtils.GetOptionalAttributeValue(mif.Node, "id");
							if (FsFeatureSystem.HasSymbolicValue(m_cache, sId))
							{
								// we want to set all other sisters that are in the database
								TreeNode sibling = tn.Parent.FirstNode;
								while (sibling != null)
								{
									if (IsTerminalNode(sibling) && sibling != tn)
									{
										mif = sibling.Tag as MasterInflectionFeature;
										if (mif != null)
										{
											sId = XmlUtils.GetOptionalAttributeValue(mif.Node, "id");
											if (FsFeatureSystem.HasSymbolicValue(m_cache, sId))
											{
												sibling.Checked = true;
												sibling.ImageIndex =
													sibling.SelectedImageIndex = (int)ImageKind.checkedBox;
											}
										}
									}
									sibling = sibling.NextNode;
								}
							}
						}
					}
					tv.Invalidate();
				}
			}
			else
			{
				if (IsTerminalNode(tn))
				{
					tn.Checked = true;
					tn.ImageIndex = tn.SelectedImageIndex = (int)ImageKind.radioSelected;
					if (tn.Parent != null)
					{
						TreeNode sibling = tn.Parent.FirstNode;
						while (sibling != null)
						{
							if (IsTerminalNode(sibling) && sibling != tn)
							{
								sibling.Checked = false;
								sibling.ImageIndex = sibling.SelectedImageIndex = (int)ImageKind.radio;
							}
							sibling = sibling.NextNode;
						}
					}
					tv.Invalidate();
				}
				m_lastSelectedTreeNode = tn;
			}
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:75,代码来源:GlossListTreeView.cs

示例5: Initialize


//.........这里部分代码省略.........
				{
					try
					{
						m_oMenuService.RemoveCommand(m_oOldCmdCopy);
					}
					catch
					{
					}
					try
					{
						m_oMenuService.RemoveCommand(m_oOldCmdPaste);
					}
					catch
					{
					}
					try
					{
						m_oMenuService.AddCommand(m_oNewCmdCopy);
					}
					catch
					{
					}
					try
					{
						m_oMenuService.AddCommand(m_oNewCmdPaste);
					}
					catch
					{
					}

					TreeViewDesigner.MenuAdded = true;
				}

				m_oTreeView.Invalidate();

				#region action menus

				#region node menu

				m_oActionMenuNode = new ActionMenuNative();
				m_oActionMenuNode.Width = 170;
				m_oActionMenuNode.Title = "Node Action Menu";

				ActionMenuGroup oMenuGroup = m_oActionMenuNode.AddMenuGroup("Editing");
				oMenuGroup.Expanded = true;
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Add Node");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Delete Node");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Add Panel");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "-");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Clear Content");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Delete TreeView");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "-");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Copy");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Paste");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "-");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Properties");
				oMenuGroup = m_oActionMenuNode.AddMenuGroup("Arranging");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Expand");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Collapse");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Move Top");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Move Bottom");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Move Up");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Move Down");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Move Left");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Move Right");
				oMenuGroup = m_oActionMenuNode.AddMenuGroup("Color Schemes");
开发者ID:ChrisMoreton,项目名称:Test3,代码行数:67,代码来源:TreeViewDesigner.cs


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