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


C# TreeNode.EnsureVisible方法代碼示例

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


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

示例1: ShowTreeNode

 internal void ShowTreeNode(TreeNode treeNode)
 {
     if (treeNode != null)
     {
         tvHtmlDoc.SelectedNode = treeNode;
         tvHtmlDoc.Focus();
         treeNode.EnsureVisible();
     }
     else {
         MessageBox.Show("Tree: Element was not found");
     }
 }
開發者ID:ksenor,項目名稱:swd-recorder,代碼行數:12,代碼來源:HtmlDomTesterView.cs

示例2: AddTreeNode

 /// <summary>
 /// 添加一個節點,並使其可見
 /// </summary>
 /// <param name="treeView"></param>
 /// <param name="newNode"></param>
 /// <param name="parentNode"></param>
 public static void AddTreeNode(TreeView treeView, TreeNode newNode, TreeNode parentNode)
 {
     if (parentNode != null)
     {
         parentNode.Nodes.Add(newNode);
         treeView.SelectedNode = parentNode;
         parentNode.Expand();
         // 讓新添加節點可視
     }
     else
     {
         treeView.Nodes.Add(newNode);
         treeView.SelectedNode = newNode;
         newNode.Expand();
     }
     newNode.EnsureVisible();
 }
開發者ID:huoxudong125,項目名稱:DotNet,代碼行數:23,代碼來源:BaseInterfaceLogic.cs

示例3: AddNew

		/// <summary>
		/// Adds the new logger view as a child of the current view and returns the new view.
		/// </summary>
		/// <param name="text">The text to initialize the view with.</param>
		/// <param name="logger">The logger that this instance is a view of.</param>
		/// <returns></returns>
		public ILoggerView AddNew(string text, LoggerItem logger)
		{
			// Creating a new node.
			TreeNode node = new TreeNode(text) {Checked = true, Tag = logger};

			if (_isRoot)
			{
				_treeView.Nodes.Add(node);
			}
			else
			{
				_node.Nodes.Add(node);
			}

			node.EnsureVisible();

			return new TreeViewLoggerView(_treeView, node);
		}
開發者ID:ASK-sa,項目名稱:ASK.ServEasy,代碼行數:24,代碼來源:TreeViewLoggerView.cs

示例4: DisplayCourse

        public void DisplayCourse(Course course)
        {
            var courseNode = new TreeNode(course.Title) { Tag = course };

            foreach (var module in course.Modules)
            {
                var moduleNode = new TreeNode(module.Title) { Tag = module };

                foreach (var lesson in module.Lessons)
                {
                    var lessonNode = new TreeNode(lesson.Title) { Tag = lesson };

                    moduleNode.Nodes.Add(lessonNode);
                }

                courseNode.Nodes.Add(moduleNode);
            }

            treeView1.Nodes.Add(courseNode);
            treeView1.ExpandAll();
            courseNode.EnsureVisible();
        }
開發者ID:bogusgithubuser,項目名稱:PluralsightDownloader,代碼行數:22,代碼來源:CourseTree.cs

示例5: AddToPageDefinitions

        internal TreeNode AddToPageDefinitions(WebElementDefinition element)
        {
            var newNode = new TreeNode();
            newNode.Text = element.ToString();
            newNode.Tag = element;

            var action = (MethodInvoker)delegate
            {

                tvWebElements.Nodes[0].Nodes.Add(newNode);
                newNode.EnsureVisible();
            };

            if (tvWebElements.InvokeRequired)
            {
                tvWebElements.Invoke(action);
            }
            else
            {
                action();
            }

            return newNode;
        }
開發者ID:ksenor,項目名稱:swd-recorder,代碼行數:24,代碼來源:PageObjectDefinitionView.cs

示例6: AddAnim

        // Добавление, удаление, исправление анимации
        private void AddAnim(int index)
        {
            if (Animdata.GetAnimData(index) == null)
                {
                    Animdata.AnimData[index] = new Animdata.Data(new sbyte[64], 0, 1, 0, 0);
                    TreeNode node = new TreeNode();
                    node.Tag = index;
                    node.Text = String.Format("0x{0:X4} {1}", index, TileData.ItemTable[index].Name);
                    if ((TileData.ItemTable[index].Flags & TileFlag.Animation) == 0)
                        node.ForeColor = Color.Blue;
                    treeViewAnim.Nodes.Add(node);
                    TreeNode subnode = new TreeNode();
                    subnode.Text = String.Format("0x{0:X4} {1}", index, TileData.ItemTable[index].Name);
                    node.Nodes.Add(subnode);
                    node.EnsureVisible();
                    treeViewAnim.SelectedNode = node;
                    Options.ChangedUltimaClass["Animdata"] = true;

                    tabcontrol.SelectedTab = tabPageAnim;
                }
        }
開發者ID:svn2github,項目名稱:fiddler-plus,代碼行數:22,代碼來源:TileDatas.cs

示例7: SelectSingleNode

        private void SelectSingleNode( TreeNode node )
        {
            if( node == null )
            {
                return;
            }

            ClearSelectedNodes();
            ToggleNode( node, true );
            node.EnsureVisible();
        }
開發者ID:Jenjen1324,項目名稱:NBTExplorer,代碼行數:11,代碼來源:MultiSelectTreeview.cs

示例8: ReplaceSelectionWith

 public void ReplaceSelectionWith(TreeNode node)
 {
     try
     {
         if (!OnBeforeSingleSelect(node))
             return;
         if (node == null || node.TreeView == null)
             return;
         removePaintFromNodes();
         SelectedNodes.Clear();
         if (node != null)
         {
             SelectedNodes.Add(node);
         }
         paintSelectedNodes();
         CallEvents();
         node.EnsureVisible();
     }
     catch (Exception e) {
         OnError(e);
     }
 }
開發者ID:drosenstark,項目名稱:KBase,代碼行數:22,代碼來源:TreeViewMultipleSelect.cs

示例9: SelectNode

 public void SelectNode(TreeNode node)
 {
     node.EnsureVisible();
     _treeView.SelectedNode = node;
 }
開發者ID:suvjunmd,項目名稱:Moritz,代碼行數:5,代碼來源:ExpansionTreeView.cs

示例10: AddResourceButton_Click

        private void AddResourceButton_Click(object sender, EventArgs e)
        {
            var dlg = new AddResourceEntryDialog();
            if (dlg.ShowDialog(this) == DialogResult.OK)
            {
                int imageindex = RepositoryIcons.GetImageIndexForResourceType((ResourceTypes)Enum.Parse(typeof(ResourceTypes), Path.GetExtension(dlg.ResourceName).Replace(".", "")));
                TreeNode n = new TreeNode(dlg.ResourceName, imageindex, imageindex);
                ResourceItem i = new ResourceItem("", dlg.HeaderFilepath, dlg.ContentFilepath);
                i.EntryType = EntryTypeEnum.Added;
                n.Tag = i;

                if (ResourceTree.SelectedNode == null || ResourceTree.SelectedNode.Parent == null)
                    ResourceTree.Nodes[0].Nodes.Add(n);
                else if (ResourceTree.SelectedNode.Tag as ResourceItem != null)
                {
                    if ((ResourceTree.SelectedNode.Tag as ResourceItem).IsFolder)
                        ResourceTree.SelectedNode.Nodes.Add(n);
                    else if (ResourceTree.SelectedNode.Parent == null)
                        ResourceTree.Nodes[0].Nodes.Add(n);
                    else
                        ResourceTree.SelectedNode.Parent.Nodes.Add(n);
                }

                n.EnsureVisible();
                ResourceTree.SelectedNode = n;
                ResourceTree.Focus();
            }
        }
開發者ID:kanbang,項目名稱:Colt,代碼行數:28,代碼來源:PackageEditorDialog.cs

示例11: SelectTreeNode

 private void SelectTreeNode(TreeView tree, TreeNode node) {
   _treeClickDisabled = true;
   tree.SelectedNode = node;
   if (node != null)
     node.EnsureVisible();
   _treeClickDisabled = false;
 }
開發者ID:androdev4u,項目名稱:XLParser,代碼行數:7,代碼來源:fmGrammarExplorer.cs

示例12: btnAdd_Click

        /// <summary>
        /// Add a new match expression
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="e">The event arguments</param>
        private void btnAdd_Click(object sender, EventArgs e)
        {
            TreeViewCancelEventArgs te = new TreeViewCancelEventArgs(tvExpressions.SelectedNode, false,
                TreeViewAction.Unknown);
            tvExpressions_BeforeSelect(tvExpressions, te);

            if(te.Cancel)
                return;

            TreeNode node = new TreeNode
            {
                Text = "T:MyNamespace.MyClass1",
                Tag = new MemberIdMatchExpression
                {
                    MatchExpression = "T:MyNamespace.MyClass1",
                    ReplacementValue = "T:MyNamespace.MyClass2"
                }
            };

            tvExpressions.Nodes.Add(node);
            tvExpressions.SelectedNode = node;
            node.EnsureVisible();
            txtMatchExpression.Focus();

            btnDelete.Enabled = txtMatchExpression.Enabled = txtReplacementValue.Enabled =
                chkMatchAsRegEx.Enabled = true;
        }
開發者ID:julianhaslinger,項目名稱:SHFB,代碼行數:32,代碼來源:MemberIDFixUpPlugInConfigDlg.cs

示例13: BuildUserHierarchy


//.........這裏部分代碼省略.........
                        //                        if(DrawRecording.DisplayName == null)
                        //                            DrawRecording.DisplayName = DrawRecording.Created.ToString();
                        TreeNode NodeRecording = new TreeNode();
                        if(DrawRecording.SessionID == "")
                        {
                            NodeRecording = NodeX.Nodes.Add(DrawRecording.DisplayName);
                        }
                        else
                        {
                            for(int a=0; a < SessionCount;a++)
                            {
                                if(DrawRecording.SessionName == NodeSessions[a].Text)
                                    NodeRecording = NodeSessions[a].Nodes.Add(DrawRecording.DisplayName);
                            }
                        }
                        //DrawRecording.Se = B.ID;
                        if(DrawRecording.IsReady)
                        {

                            NodeRecording.Tag = DrawRecording;
                        }
                        else
                        {
                            NodeRecording.ForeColor = System.Drawing.Color.Gray;
                        }

                        NodeRecording.ImageIndex = 3;
                        NodeRecording.SelectedImageIndex = 3;
                        NodeRecording.NodeFont = new Font("Arial",10,FontStyle.Regular);
                        if(g_SelectedAnItem == false)
                        {
                            g_SelectedAnItem = true;
                            treeView1.SelectedNode = NodeRecording;
                            NodeRecording.EnsureVisible();
                            MouseEventArgs A = new MouseEventArgs(MouseButtons.Left,1,1,1,0);
                            treeView1_MouseUp(treeView1,A);
                        }
                        if(OpenToRecording == DrawRecording.ID)
                        {
                            //        NodeRecording.EnsureVisible();
                            treeView1.SelectedNode = NodeRecording;
                            // g_objRecording = DrawRecording;
                            g_objRecording = DrawRecording;
                        }
                    }
                }
            }
            //This Section Displays this LoginUser's Member Sections
            if(LoginUser.HighestAuthorityLevel.ID != OSystem.SectionTypeSysAdmin.ID)
            {
                OysterClassLibrary.Sections MembersOf = LoginUser.AllMemberSections; // F.GetMemberSections(LoginUser.ID,false);
                TreeNode Members = new TreeNode();
                if(MembersOf.Count > 0)
                {
                    Members = Root.Nodes.Add("My Recordings");
                    Members.ForeColor = System.Drawing.Color.Green;
                    //Members.NodeFont = new Font("Arial",10,FontStyle.Bold);
                    Members.ImageIndex = 7;
                    Members.SelectedImageIndex = 7;
                    int Counter2 = OSystem.CurrentSectionTypes.Count;
                    OysterClassLibrary.SectionType nUT2 = OSystem.SectionTypeSysAdmin;
                    test = nUT2.Description;
                    listonce = false;
                    Label = new TreeNode();
                    TreeNode NodeMember = new TreeNode();
                    while( Counter2 > 0)
開發者ID:CarverLab,項目名稱:Oyster,代碼行數:67,代碼來源:testMain.cs

示例14: AddGraphic

        /// <summary>
        /// Adds Graphic with type and name to List
        /// </summary>
        /// <param name="graphic"></param>
        /// <param name="type"></param>
        /// <param name="name"></param>
        public void AddGraphic(int graphic, int type, string name)
        {
            TreeViewMobs.BeginUpdate();
            TreeViewMobs.TreeViewNodeSorter = null;
            TreeNode nodeparent = new TreeNode(name);
            nodeparent.Tag = new int[] { graphic, type };
            nodeparent.ToolTipText = Animations.GetFileName(graphic);
            if (type == 4)
            {
                TreeViewMobs.Nodes[1].Nodes.Add(nodeparent);
                type = 3;
            }
            else
                TreeViewMobs.Nodes[0].Nodes.Add(nodeparent);

            TreeNode node;
            for (int i = 0; i < AnimNames[type].GetLength(0); ++i)
            {
                if (Animations.IsActionDefined(graphic, i, 0))
                {
                    node = new TreeNode(i.ToString() + " " + AnimNames[type][i]);
                    node.Tag = i;
                    nodeparent.Nodes.Add(node);
                }
            }
            if (!sortalpha)
                TreeViewMobs.TreeViewNodeSorter = new GraphicSorter();
            else
                TreeViewMobs.TreeViewNodeSorter = new AlphaSorter();
            TreeViewMobs.Sort();
            TreeViewMobs.EndUpdate();
            LoadListView();
            TreeViewMobs.SelectedNode = nodeparent;
            nodeparent.EnsureVisible();
        }
開發者ID:svn2github,項目名稱:fiddler-plus,代碼行數:41,代碼來源:Animationlist.cs

示例15: AddFolderShortcut

		/// <summary>
		/// Adds the given path to the root node in the folder treeview, so it looks
		/// like a shortcut.
		/// </summary>
		/// <param name="name">Name of folder</param>
		/// <param name="path">Full path of folder</param>
		private void AddFolderShortcut(string name, string path)
		{
			// Special image with index 18 only used in shortcuts:
			var shortcutNode = new TreeNode {Tag = path, Text = name, ImageIndex = 18, SelectedImageIndex = 18};

			_treeNodeRootNode.Nodes.Add(shortcutNode);

			AddChildFolders(shortcutNode);

			shortcutNode.TreeView.SelectedNode = shortcutNode;
			shortcutNode.EnsureVisible();
			shortcutNode.TreeView.Focus();
		}
開發者ID:jwickberg,項目名稱:libpalaso,代碼行數:19,代碼來源:FolderBrowserControl.cs


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