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


C# TreeNodeCollection.MoveNext方法代码示例

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


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

示例1: EnsureVisible

		public void EnsureVisible()
		{
			if( null == treeView ) return;
			
			TreeView.NodeEnumerator nodes;
			int nodeFromTop;
			int nodeNo;
			while (true)
			{
				// Find "this" node number and position from the top control.
				nodeFromTop = -1;
				nodeNo = 0;
				bool nodeFound = false;
				nodes = new TreeView.NodeEnumerator(treeView.nodes);
				while (nodes.MoveNext())
				{
					if (nodes.currentNode == treeView.topNode)
					{
						// We are at the top of the control.
						nodeFromTop = 0;
					}
					if (nodes.currentNode == this)
					{
						if (nodeFromTop < 0)
						{
							treeView.topNode = this;
							treeView.Invalidate();
							return;
						}
						nodeFound = true;
						break;
					}
					if (nodeFromTop >= 0)
					{
						nodeFromTop++;
					}
					nodeNo++;
				}
			

				if (nodeFound)
				{
					break;
				}
				else
				{
					// Make sure all parents are expanded and see if its now visible.
					TreeNode node = this;
					TreeNode highestNode = node;
					for (; node != null; node = node.Parent)
					{
						node.expanded = true;
						highestNode = node;
					}
					treeView.InvalidateDown(highestNode);
				}
			}

			int visibleNodes = treeView.VisibleCountActual;
			// See if its already visible.
			if (nodeFromTop < visibleNodes)
			{
				return;
			}

			// Set the top node no we want to make this node 1 up from the bottom.
			nodeFromTop = nodeNo - visibleNodes + 1;
			if (nodeFromTop < 0)
			{
				nodeFromTop = 0;
			}

			// Find the node corresponding to this node no.
			nodes.Reset();
			nodeNo = 0;
			while (nodes.MoveNext())
			{
				if (nodeFromTop == nodeNo)
				{
					treeView.topNode = nodes.currentNode;
					treeView.Invalidate();
					break;
				}
				nodeNo++;
			}
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:86,代码来源:TreeNode.cs


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