本文整理汇总了C#中System.Windows.Forms.TreeNode类的典型用法代码示例。如果您正苦于以下问题:C# TreeNode类的具体用法?C# TreeNode怎么用?C# TreeNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TreeNode类属于System.Windows.Forms命名空间,在下文中一共展示了TreeNode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: RecurrsiveSearch
private TreeNode RecurrsiveSearch(int id)
{
Hash source = Project.Data.MapInfos;
var mapInfo = source[id] as MapInfo;
if (mapInfo != null)
{
var node = new TreeNode
{
Name = id.ToString(),
ImageIndex = 1,
SelectedImageIndex = 1,
Text = mapInfo.name,
Tag = mapInfo
};
foreach (MapInfo info in source.Values)
{
int childId = source.GetKey(info);
if (info.parent_id == id && !_skipIds.Contains(childId))
{
_skipIds.Add(childId);
node.Nodes.Add(RecurrsiveSearch(childId));
}
}
return node;
}
return null;
}
开发者ID:borisblizzard,项目名称:arcreator,代码行数:27,代码来源:MapEditorMainForm.cs
示例2: AddProjectNode
public TreeNode AddProjectNode(TreeNode motherNode, IProject project)
{
ProjectNode projectNode = new ProjectNode(project);
projectNode.AddTo(motherNode);
ReferenceFolder referenceFolderNode = new ReferenceFolder(project);
referenceFolderNode.AddTo(projectNode);
//TagManagerNode tagManagerNode = new TagManagerNode(project);
//tagManagerNode.AddTo(projectNode);
//
// TagListFileNode tagListFileNode = new TagListFileNode(TagManager.FullFileName, FileNodeStatus.InProject);
// tagListFileNode.AddTo(projectNode);
// TagGroupNode tagGroupNode = new TagGroupNode(project);
// tagGroupNode.AddTo(projectNode);
// AimTagGroupFolderNode aimTagGroupFolderNode = new AimTagGroupFolderNode(project);
// aimTagGroupFolderNode.AddTo(projectNode);
//
// SecurityNode securityNode = new SecurityNode(project);
// securityNode.AddTo(projectNode);
//DriverFolderNode driverFolderNode = new DriverFolderNode(project);
//driverFolderNode.AddTo(projectNode);
motherNode.TreeView.MouseDoubleClick += new MouseEventHandler(TreeView_MouseDoubleClick);
return projectNode;
}
开发者ID:garryforreg,项目名称:iview-scada,代码行数:30,代码来源:AimProjectNodeBuilder.cs
示例3: Init
/// <summary>
/// 初始化(获取mongodb信息)
/// </summary>
public void Init()
{
this.treeView1.Nodes.Clear();
connectionString = this.textBox_MongoUrl.Text;
service = new MongoService(new MongoConnectionString(connectionString));
//所有数据库
var listDatabase = service.client.ListDatabases().ToList();
foreach(BsonDocument dbDoc in listDatabase)
{
var dbName = dbDoc["name"].ToString();
TreeNode dbNode = new TreeNode(dbName, 0, 0);
dbNode.Tag = "database";
var db = service.client.GetDatabase(dbName);
//所有集合(可以理解为表)
var listCollection = db.ListCollections().ToList();
foreach (BsonDocument collDoc in listCollection)
{
var collName = collDoc["name"].ToString();
TreeNode collNode = new TreeNode(collName,1,1);
collNode.Tag = "collection";
dbNode.Nodes.Add(collNode);
}
this.treeView1.Nodes.Add(dbNode);
}
}
开发者ID:yksoft,项目名称:MyMongoDB,代码行数:29,代码来源:MongoView.cs
示例4: agregarNodo
private void agregarNodo(XmlNode inXmlNode, TreeNode inTreeNode)
{
XmlNode xNode;
TreeNode tNode;
XmlNodeList nodeList;
int i;
// Loop through the XML nodes until the leaf is reached.
// Add the nodes to the TreeView during the looping process.
if (inXmlNode.HasChildNodes)
{
nodeList = inXmlNode.ChildNodes;
for (i = 0; i <= nodeList.Count - 1; i++)
{
xNode = inXmlNode.ChildNodes[i];
inTreeNode.Nodes.Add(xNode.Attributes["Nombre"].Value);
tNode = inTreeNode.Nodes[i];
agregarNodo(xNode, tNode);
}
}
else
{
// Here you need to pull the data from the XmlNode based on the
// type of node, whether attribute values are required, and so forth.
inTreeNode.Text = inXmlNode.Attributes["Nombre"].Value;
}
}
开发者ID:hvivani,项目名称:SOffT,代码行数:27,代码来源:frmPermisos.cs
示例5: initTrvTree
public void initTrvTree(TreeNodeCollection treeNodes, string strParentIndex, DataView dvList)
{
try
{
TreeNode tempNode;
DataView dvList1;
string currentNum;
dvList1 = dvList;
// select the datarow that it's parentcode is strParentIndex
DataRow[] dataRows = dvList.Table.Select("parentCode ='" + strParentIndex + "'");
foreach (DataRow dr in dataRows)
{
tempNode = new TreeNode();
tempNode.Text = dr["bookTypeCode"].ToString() + "-"
+ dr["bookTypeName"].ToString();
// tag property is save data about this treenode
tempNode.Tag = new treeNodeData(dr["bookTypeCode"].ToString(),
dr["bookTypeName"].ToString(), dr["bookTypeExplain"].ToString(),
dr["currentCode"].ToString(), dr["parentCode"].ToString());
currentNum = dr["currentCode"].ToString();
treeNodes.Add(tempNode);
// call rucursive
TreeNodeCollection temp_nodes = treeNodes[treeNodes.Count - 1].Nodes;
initTrvTree(temp_nodes, currentNum, dvList1);
}
}
catch (Exception)
{
MessageBox.Show("初始化TreeView失败");
}
}
开发者ID:ATLgo,项目名称:bookMis,代码行数:32,代码来源:bookTypeClass.cs
示例6: CreatPropertiesTree
private void CreatPropertiesTree()
{
DataTable dtproperty = CommonFuncCall.GetDictionariesByDic_codes("sys_enterprise_property");
TreeNode tmpNd;
if (dtproperty != null)
{
foreach (DataRow drv in dtproperty.Rows)
{
tmpNd = new TreeNode();
tmpNd.Tag = drv;
tmpNd.Text = drv["dic_name"].ToString(); //name
//tmpNd.Name = drv["dic_id"].ToString();//id
tmpNd.Name = string.Empty;//id
this.tvNature.Nodes.Add(tmpNd);
}
}
ArrayList dic_name = new ArrayList();
dic_name.Add("sys_enterprise_property");
dtproperty = CommonFuncCall.GetDictionariesByPDic_codes(dic_name);
if (dtproperty != null)
{
foreach (DataRow drv in dtproperty.Rows)
{
tmpNd = new TreeNode();
tmpNd.Tag = drv;
tmpNd.Text = drv["dic_name"].ToString(); //name
tmpNd.Name = drv["dic_id"].ToString();//id
this.tvNature.Nodes[0].Nodes.Add(tmpNd);
}
}
this.tvNature.Nodes[0].Expand();
}
开发者ID:caocf,项目名称:workspace-kepler,代码行数:32,代码来源:frmSupplier.cs
示例7: GetTree
public static TreeNode[] GetTree(this Ast ast)
{
var index = new Dictionary<Ast, TreeNode>();
var tree = new List<TreeNode>();
foreach (var ast1 in ast.FindAll(_ => true, true).ToList())
{
var node = new TreeNode(ast1.GetType().ToString().Split('.').Last());
node.ToolTipText = ast1.Extent.Text;
index.Add(ast1, node);
TreeNode parent;
if (ast1.Parent != null && index.TryGetValue(ast1.Parent, out parent))
{
parent.Nodes.Add(node);
}
else
{
tree.Add(node);
}
}
return tree.ToArray();
}
开发者ID:cmanrus,项目名称:challenge,代码行数:25,代码来源:DisplayExtensions.cs
示例8: DisplayExceptionDetails
private void DisplayExceptionDetails(TreeNode node)
{
var exception = _exceptionDetailsList[node];
exceptionDetailsListView.SuspendLayout();
exceptionDetailsListView.Items.Clear();
if (exception.Type != null) exceptionDetailsListView.Items.Add("Exception").SubItems.Add(exception.Type);
if (exception.Message != null) exceptionDetailsListView.Items.Add("Message").SubItems.Add(exception.Message);
if (exception.TargetSite != null) exceptionDetailsListView.Items.Add("Target Site").SubItems.Add(exception.TargetSite);
if (exception.InnerException != null) exceptionDetailsListView.Items.Add("Inner Exception").SubItems.Add(exception.InnerException.Type);
if (exception.Source != null) exceptionDetailsListView.Items.Add("Source").SubItems.Add(exception.Source);
if (exception.HelpLink != null) exceptionDetailsListView.Items.Add("Help Link").SubItems.Add(exception.HelpLink);
if (exception.StackTrace != null) exceptionDetailsListView.Items.Add("Stack Trace").SubItems.Add(exception.StackTrace);
if (exception.Data != null)
{
foreach (var pair in exception.Data)
{
exceptionDetailsListView.Items.Add(string.Format("Data[\"{0}\"]", pair.Key)).SubItems.Add(pair.Value.ToString());
}
}
if (exception.ExtendedInformation != null)
{
foreach (var info in exception.ExtendedInformation)
{
var item = exceptionDetailsListView.Items.Add(info.Key);
item.UseItemStyleForSubItems = false;
item.Font = new Font(Font, FontStyle.Bold);
item.SubItems.Add(info.Value.ToString());
}
}
exceptionDetailsListView.ResumeLayout();
}
开发者ID:mgnslndh,项目名称:NCrash,代码行数:35,代码来源:ExceptionDetails.cs
示例9: BuildCyberwareTree
/// <summary>
/// Build up the Tree for the current piece of Cyberware and all of its children.
/// </summary>
/// <param name="objCyberware">Cyberware to iterate through.</param>
/// <param name="objParentNode">TreeNode to append to.</param>
/// <param name="objMenu">ContextMenuStrip that the new Cyberware TreeNodes should use.</param>
/// <param name="objGearMenu">ContextMenuStrip that the new Gear TreeNodes should use.</param>
public void BuildCyberwareTree(Cyberware objCyberware, TreeNode objParentNode, ContextMenuStrip objMenu, ContextMenuStrip objGearMenu)
{
TreeNode objNode = new TreeNode();
objNode.Text = objCyberware.DisplayName;
objNode.Tag = objCyberware.InternalId;
if (objCyberware.Notes != string.Empty)
objNode.ForeColor = Color.SaddleBrown;
objNode.ToolTipText = objCyberware.Notes;
objNode.ContextMenuStrip = objMenu;
objParentNode.Nodes.Add(objNode);
objParentNode.Expand();
foreach (Cyberware objChild in objCyberware.Children)
BuildCyberwareTree(objChild, objNode, objMenu, objGearMenu);
foreach (Gear objGear in objCyberware.Gear)
{
TreeNode objGearNode = new TreeNode();
objGearNode.Text = objGear.DisplayName;
objGearNode.Tag = objGear.InternalId;
if (objGear.Notes != string.Empty)
objGearNode.ForeColor = Color.SaddleBrown;
objGearNode.ToolTipText = objGear.Notes;
objGearNode.ContextMenuStrip = objGearMenu;
BuildGearTree(objGear, objGearNode, objGearMenu);
objNode.Nodes.Add(objGearNode);
objNode.Expand();
}
}
开发者ID:hollis21,项目名称:Chummer,代码行数:39,代码来源:clsCommon.cs
示例10: BindTags
private void BindTags()
{
cbTagCategory.DisplayMember = "Name";
cbTagCategory.ValueMember = "ID";
cbTagCategory.DataSource = TagCategories;
tvTags.Nodes.Clear();
foreach (var tc in TagCategories)
{
var catNode = new TreeNode();
catNode.Text = tc.Name;
foreach (var t in Tags.Where(w => w.TagCategoryID == tc.ID))
{
var tNode = new TreeNode();
tNode.Text = t.Name;
tNode.Tag = t;
tNode.Checked = SelectedTags.Exists(w => w.ID == t.ID);
catNode.Nodes.Add(tNode);
}
tvTags.Nodes.Add(catNode);
}
tvTags.ExpandAll();
}
开发者ID:JTOne123,项目名称:ukrsecond,代码行数:28,代码来源:TagDetailForm.cs
示例11: MULT
public MULT(RARC.FileEntry FE, ref int SrcOffset, TreeNode ParentNode, System.Drawing.Color Color = default(System.Drawing.Color))
{
ParentFile = FE;
byte[] SrcData = ParentFile.GetFileData();
Offset = SrcOffset;
_Translation = new Vector2(
Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset)),
Helpers.ConvertIEEE754Float(Helpers.Read32(SrcData, SrcOffset + 0x04)));
_Rotation = ((short)(Helpers.Read16(SrcData, SrcOffset + 0x08)) / 182.04444444444444f).Clamp(-180, 179);
_RoomNumber = SrcData[SrcOffset + 0x0A];
_Unknown2 = SrcData[SrcOffset + 0x0B];
SrcOffset += 0x0C;
RenderColor = Color;
Node = Helpers.CreateTreeNode(string.Format("{0:X6}: {1}", Offset, new Vector2(_Translation.X / 100000, _Translation.Y / 100000)), this, string.Format("{0}", _Translation));
ParentNode.BackColor = RenderColor;
ParentNode.Nodes.Add(Node);
GLID = GL.GenLists(1);
GL.NewList(GLID, ListMode.Compile);
Helpers.DrawFramedCube(new Vector3d(15, 15, 15));
GL.EndList();
}
开发者ID:pho,项目名称:WindViewer,代码行数:28,代码来源:MULT.cs
示例12: TableViewForm
public TableViewForm(TreeNode analysisViewNode)
{
InitializeComponent();
mAnalysisViewNode = analysisViewNode;
mTask = ((TaskModel)analysisViewNode.Parent.Parent.Tag).mTask;
}
开发者ID:hong1975,项目名称:wats,代码行数:7,代码来源:TableViewForm.cs
示例13: RootNode
//private int len = 2;
public void RootNode(TreeNode pNode)
{
if (ds == null)
return;
DataView dvTree = new DataView(ds.Tables[0]);
//dvTree.RowFilter = "len(Code)=" + len.ToString();
dvTree.RowFilter = "Parent_Code=0";//Rank=1";
foreach (DataRowView Row in dvTree)
{
TreeNode Node = this.Nodes.Add(Row["Code"].ToString(), "[" + Row["Code"].ToString() + "]" + Row["Name"].ToString(), 1);
//AddNode(Node, len);
AddNode(Node);
}
this.ExpandAll();
if (m_SelectName.Trim() == "")
return;
foreach (TreeNode nt in this.Nodes)
{
if (nt.Name == SelectStringByLen(2))
{
this.SelectedNode = nt;
if (m_SelectName.Length > 2)
Select(nt);
return;
}
}
}
开发者ID:wuyanqing,项目名称:wc001,代码行数:29,代码来源:PowerTreeView.cs
示例14: testPointView_AfterSelect
private void testPointView_AfterSelect(object sender, TreeViewEventArgs e)
{
TreeNode tmpNode;
ItemObject tmpObj;
List<ItemObject> stack;
if (e.Node == Root) return; //根节点返回
ItemObject itm = e.Node.Tag as ItemObject;
listProperty(itm);
#region 显示当前的item
stack = new List<ItemObject>(10);
tmpNode = e.Node;
stack.Add(tmpNode.Tag as ItemObject);
while ((tmpNode.Tag as ItemObject).type != PptType.Slide)
{
tmpNode = tmpNode.Parent;
stack.Add(tmpNode.Tag as ItemObject);
}
while (stack.Count > 0)
{
try
{
tmpObj = stack[stack.Count - 1];
showSomething(tmpObj);
stack.RemoveAt(stack.Count - 1);
}
catch
{
throw;
}
}
#endregion
}
开发者ID:kaiss78,项目名称:hustoes,代码行数:32,代码来源:testPowerpoint_old.cs
示例15: FormQueryName
public FormQueryName(int userId, TreeView treeView, TreeNode folderNode)
{
InitializeComponent();
_connectionID = userId;
_original = treeView;
CurrentFolderNode = folderNode;
}
开发者ID:clarencemorse,项目名称:myzilla,代码行数:7,代码来源:FormQueryName.cs
示例16: TransitionWizard
public TransitionWizard()
{
TransitionWizard twiz = this;
base.Load += new EventHandler(twiz.Twiz_Load);
this.ViewTiles = false;
this.iMapNode = new TreeNode("Map Tiles");
this.iStaticNode = new TreeNode("Static Tiles");
this.iMapOuterTopLeft = new TreeNode("Outer Top Left");
this.iMapOuterTopRight = new TreeNode("Outer Top Right");
this.iMapOuterBottomLeft = new TreeNode("Outer Bottom Left");
this.iMapOuterBottomRight = new TreeNode("Outer Bottom Right");
this.iMapInnerTopLeft = new TreeNode("Inner Top Left");
this.iMapInnerTop = new TreeNode("Inner Top");
this.iMapInnerTopRight = new TreeNode("Inner Top Right");
this.iMapInnerLeft = new TreeNode("Inner Left");
this.iMapInnerRight = new TreeNode("Inner Right");
this.iMapInnerBottomLeft = new TreeNode("Inner Bottom Left");
this.iMapInnerBottom = new TreeNode("Inner Bottom");
this.iMapInnerBottomRight = new TreeNode("Inner Bottom Right");
this.iStaticOuterTopLeft = new TreeNode("Outer Top Left");
this.iStaticOuterTopRight = new TreeNode("Outer Top Right");
this.iStaticOuterBottomLeft = new TreeNode("Outer Bottom Left");
this.iStaticOuterBottomRight = new TreeNode("Outer Bottom Right");
this.iStaticInnerTopLeft = new TreeNode("Inner Top Left");
this.iStaticInnerTop = new TreeNode("Inner Top");
this.iStaticInnerTopRight = new TreeNode("Inner Top Right");
this.iStaticInnerLeft = new TreeNode("Inner Left");
this.iStaticInnerRight = new TreeNode("Inner Right");
this.iStaticInnerBottomLeft = new TreeNode("Inner Bottom Left");
this.iStaticInnerBottom = new TreeNode("Inner Bottom");
this.iStaticInnerBottomRight = new TreeNode("Inner Bottom Right");
this.iGroupA = new ClsTerrainTable();
this.iGroupB = new ClsTerrainTable();
InitializeComponent();
}
开发者ID:HankTheDrunk,项目名称:ultimaonlinemapcreator,代码行数:35,代码来源:TransitionWizard.cs
示例17: dataAnlysis_Load
private void dataAnlysis_Load(object sender, EventArgs e)
{
treeView1.Nodes.Clear();
//提取数据库中各表的字段
DataTable dt =streamMessagePool . Acc.Tables;
TreeNode txtRoot = new TreeNode("Dump_Detail_Table");
treeView1.Nodes.Add(txtRoot);
for (int i = 0; i < dt.Rows.Count; i++)
{
string tb = dt.Rows[i]["TABLE_NAME"].ToString();
TreeNode rootMessage = new TreeNode(tb);
txtRoot.Nodes.Add(rootMessage);
}
//提取消息字段和数量
dt = streamMessagePool.Acc.RunQuery("select message_info,count(*) c from softerCell_have_read"+
" group by message_info order by 2 desc ");
TreeNode infoRoot = new TreeNode("Info_Field_Table");
treeView1.Nodes.Add(infoRoot);
for (int i = 0; i < dt.Rows.Count; i++)
{
string tb = dt.Rows[i][0].ToString() + "," + dt.Rows[i][1].ToString();
TreeNode rootMessage = new TreeNode(tb);
infoRoot.Nodes.Add(rootMessage);
}
TreeNode dataRoot = new TreeNode("Data_Table_Field");
treeView1.Nodes.Add(dataRoot);
treeView1.ExpandAll();
treeView1.SelectedNode = txtRoot;
}
开发者ID:sushantnitk,项目名称:wiresharkplugin,代码行数:33,代码来源:dataAnlysis.cs
示例18: checkIfNodeHasType
public TreeNode checkIfNodeHasType(TreeNode nodeToSearch, string nodeName, string expectedNodeType,
ascx_O2Reflector.AvailableEngines engineToTest)
{
TreeNode node = nodeToSearch.Nodes[nodeName];
testEngineNode(node, expectedNodeType, nodeName, engineToTest, false);
return node;
}
开发者ID:pusp,项目名称:o2platform,代码行数:7,代码来源:Test_ascx_O2Reflector.cs
示例19: LoadRootNodes
/// <summary>
/// Loads the root TreeView nodes.
/// </summary>
private void LoadRootNodes()
{
// Create the root shell item.
ShellItem m_shDesktop = new ShellItem();
// Create the root node.
TreeNode tvwRoot = new TreeNode();
tvwRoot.Text = m_shDesktop.DisplayName;
tvwRoot.ImageIndex = m_shDesktop.IconIndex;
tvwRoot.SelectedImageIndex = m_shDesktop.IconIndex;
tvwRoot.Tag = m_shDesktop;
// Now we need to add any children to the root node.
ArrayList arrChildren = m_shDesktop.GetSubFolders();
foreach (ShellItem shChild in arrChildren)
{
TreeNode tvwChild = new TreeNode();
tvwChild.Text = shChild.DisplayName;
tvwChild.ImageIndex = shChild.IconIndex;
tvwChild.SelectedImageIndex = shChild.IconIndex;
tvwChild.Tag = shChild;
// If this is a folder item and has children then add a place holder node.
if (shChild.IsFolder && shChild.HasSubFolder)
tvwChild.Nodes.Add("PH");
tvwRoot.Nodes.Add(tvwChild);
}
// Add the root node to the tree.
treeWnd.Nodes.Clear();
treeWnd.Nodes.Add(tvwRoot);
tvwRoot.Expand();
}
开发者ID:depthlove,项目名称:pcclient,代码行数:36,代码来源:ExplorerTreeView.cs
示例20: AddTreeNode
private void AddTreeNode(ChangeDetails detail)
{
try
{
var details = detail.FileName.Split('/');
TreeNode node;
foreach (var item in details)
{
if (treeViewFiles.Nodes.ContainsKey(item))
{
node = treeViewFiles.Nodes.Find(item, false).First();
}
else
{
node = new TreeNode(item);
node.Tag = detail;
treeViewFiles.Nodes.Add(node);
}
}
node = new TreeNode(detail.ChangeDate.ToString());
node.Tag = detail;
node.Nodes.Add(node);
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
}
开发者ID:naztrain,项目名称:vixen,代码行数:32,代码来源:Versioning.cs
注:本文中的System.Windows.Forms.TreeNode类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论