本文整理汇总了C#中System.Windows.Forms.TreeNode.Toggle方法的典型用法代码示例。如果您正苦于以下问题:C# TreeNode.Toggle方法的具体用法?C# TreeNode.Toggle怎么用?C# TreeNode.Toggle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.TreeNode
的用法示例。
在下文中一共展示了TreeNode.Toggle方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OpenTreeViewNode
private bool OpenTreeViewNode(TreeNode curNode, bool toggle)
{
if (curNode.Tag is PackageRelationship)
{
PackageRelationship rel = (PackageRelationship)curNode.Tag;
if (rel.TargetMode == TargetMode.Internal)
{
Uri target = System.IO.Packaging.PackUriHelper.ResolvePartUri(rel.SourceUri, rel.TargetUri);
DocumentPart docPart = docPkg.DocParts[target.ToString()];
Debug.Assert(docPart != null);
if (docPart != null)
{
TreeNode[] nodes = treeView.Nodes.Find(docPart.Path, true);
Debug.Assert(nodes.Length == 1);
if (nodes.Length > 0)
{
TreeNode node = nodes[0];
treeView.SelectedNode = node;
}
}
}
else
{
// follow external link
if (MessageBox.Show(
this,
"Are you sure you want to follow this external link?",
AboutForm.AssemblyTitle,
MessageBoxButtons.YesNo,
MessageBoxIcon.Information) == DialogResult.Yes)
{
System.Diagnostics.Process.Start(rel.TargetUri.ToString());
}
}
return true;
}
else if (curNode.Tag is DocumentPart)
{
DocumentPart part = (DocumentPart)curNode.Tag;
OpenPartEditor(part);
return true;
}
else if ((curNode.Tag is DocumentPackage || curNode.Tag == null) && toggle)
{
// folder or document
curNode.Toggle();
return true;
}
return false;
}
开发者ID:VitorX,项目名称:Open-XML-Package-Editor-Power-Tool-for-Visual-Studio,代码行数:50,代码来源:PackageEditorPane.cs
示例2: Form2_Load
private void Form2_Load(object sender, EventArgs e)
{
TreeNode root = new TreeNode(db.getDbName());
DataSet ds = db.Select("SELECT tablename FROM pg_tables WHERE schemaname = 'public' ");
this.treeView1.Nodes.Add(root);
for (int i = 0; i < ds.Tables[0].Rows.Count; i++) {
root.Nodes.Add(ds.Tables[0].Rows[i][0].ToString(),ds.Tables[0].Rows[i][0].ToString(),1,2);
}
root.Toggle();
setMsg( root.Text + " ���سɹ������ݱ����" + ds.Tables[0].Rows.Count + "��");
listView1.Columns.Add("�ֶ�", 200);
listView1.Columns.Add("����", 300);
listView1.CheckBoxes = true;
listView1.View = View.Details;
}
示例3: AddProject
void AddProject(TreeNode snode, string name)
{
var path = (snode.Tag as GSolution).SPath + "\\" + name;
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
var project = new GProject(path) { Text = name };
_solution.Projects.Add(project);
var node = new TreeNode(name) { Tag = project };
node.ImageIndex = (int)ImageListEnum.Project;
node.SelectedImageIndex = node.ImageIndex;
snode.Nodes.Add(node);
snode.Toggle();
fileTree.SelectedNode = node;
}
示例4: AddFile
void AddFile(TreeNode snode, string name)
{
#region 检查文件名是否已存在
foreach (TreeNode nd in snode.Nodes)
{
if (nd.Tag is GFile)
{
var fle = nd.Tag as GFile;
if (fle.Text.Equals(name, StringComparison.CurrentCultureIgnoreCase))
{
KryptonMessageBox.Show("文件名已存在!");
return;
}
}
}
#endregion
var path = string.Empty;
if (snode.Tag is GProject)
{
path = (snode.Tag as GProject).SPath + "\\" + name;
}
else
{
path = (snode.Tag as GFolder).SPath + "\\" + name;
}
var tab = tabControl.AddNewTab(name, path);
WebBrowser browser = new WebBrowser();
var defaultPage = ConfigurationManager.AppSettings["defaultPage"];
if (defaultPage == null || defaultPage.Length == 0)
{
throw new Exception("系统配置错误,初始页面不能为空,请检查配置文件!");
}
browser.Url = new Uri(defaultPage);
browser.ObjectForScripting = this;
browser.Dock = DockStyle.Fill;
tab.Container.Controls.Add(browser);
var file = new GFile(path) { Text = name, Tab = tab };
if (snode.Tag is GProject)
{
(snode.Tag as GProject).Files.Add(file);
}
else
{
(snode.Tag as GFolder).Files.Add(file);
}
var node = new TreeNode(name) { Tag = file };
node.ImageIndex = (int)ImageListEnum.File;
node.SelectedImageIndex = node.ImageIndex;
snode.Nodes.Add(node);
snode.Toggle();
fileTree.SelectedNode = node;
}
示例5: AddFolder
void AddFolder(TreeNode snode, string name)
{
#region 检查文件夹名称是否已存在
foreach (TreeNode nd in snode.Nodes)
{
if (nd.Tag is GFolder)
{
var fld = nd.Tag as GFolder;
if (fld.Text.Equals(name, StringComparison.CurrentCultureIgnoreCase))
{
KryptonMessageBox.Show("文件夹名称已存在!");
return;
}
}
}
#endregion
var path = (snode.Tag as GProject).SPath + "\\" + name;
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
var folder = new GFolder(path) { Text = name };
(snode.Tag as GProject).Folders.Add(folder);
var node = new TreeNode(name) { Tag = folder };
node.ImageIndex = (int)ImageListEnum.Folder;
node.SelectedImageIndex = node.ImageIndex;
snode.Nodes.Add(node);
snode.Toggle();
fileTree.SelectedNode = node;
}