本文整理汇总了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");
}
}
示例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();
}
示例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);
}
示例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();
}
示例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;
}
示例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;
}
}
示例7: SelectSingleNode
private void SelectSingleNode( TreeNode node )
{
if( node == null )
{
return;
}
ClearSelectedNodes();
ToggleNode( node, true );
node.EnsureVisible();
}
示例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);
}
}
示例9: SelectNode
public void SelectNode(TreeNode node)
{
node.EnsureVisible();
_treeView.SelectedNode = node;
}
示例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();
}
}
示例11: SelectTreeNode
private void SelectTreeNode(TreeView tree, TreeNode node) {
_treeClickDisabled = true;
tree.SelectedNode = node;
if (node != null)
node.EnsureVisible();
_treeClickDisabled = false;
}
示例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;
}
示例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)
示例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();
}
示例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();
}