本文整理汇总了C#中TreeList.AppendNode方法的典型用法代码示例。如果您正苦于以下问题:C# TreeList.AppendNode方法的具体用法?C# TreeList.AppendNode怎么用?C# TreeList.AppendNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TreeList
的用法示例。
在下文中一共展示了TreeList.AppendNode方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddTreeListNode
public TreeListNode AddTreeListNode(TreeList treelist, TreeListNode node, Type type, string propertyName, string defaultFunction, string validationFunction)
{
TreeListNode newNode = treelist.AppendNode(new object[] { propertyName, defaultFunction, validationFunction }, node);
//newNode.ImageIndex = newNode.SelectImageIndex = (int)image;
newNode.Tag = type;
return newNode;
}
示例2: CreateNodes
private void CreateNodes(TreeList tl)
{
tl.BeginUnboundLoad();
// Create a root node .
TreeListNode parentForRootNodes = null;
TreeListNode rootNode = tl.AppendNode(new object[] { "Thống kê tổng quát" }, parentForRootNodes);
TreeListNode rootNode1 = tl.AppendNode(new object[] { "Thống kê chi tiết" }, parentForRootNodes);
// Create a child of the rootNode
tl.AppendNode(new object[] { "Cơ sở"}, rootNode1);
tl.AppendNode(new object[] { "Dãy" }, rootNode1);
tl.AppendNode(new object[] { "Tầng" }, rootNode1);
tl.AppendNode(new object[] { "Phòng" }, rootNode1);
tl.AppendNode(new object[] { "Thiết bị" }, rootNode1);
TreeListNode rootNode2 = tl.AppendNode(new object[] { "Thống kê động" }, parentForRootNodes);
// Creating more nodes
// ...
tl.EndUnboundLoad();
}
示例3: AdapterTreeList
public void AdapterTreeList(TreeList treeList)
{
this.m_TreeList = treeList;
//treeList.Columns.Clear();
//treeList.Columns.Add();
//TreeListColumn tlColName = treeList.Columns.Add();
treeList.FocusedNodeChanged += new FocusedNodeChangedEventHandler(treeList_FocusedNodeChanged);
// treeList.MouseClick += new System.Windows.Forms.MouseEventHandler(treeList_MouseClick);
treeList.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(treeList_MouseDoubleClick);
treeList.MouseDown += new System.Windows.Forms.MouseEventHandler(treeList_MouseDown);
ICatalogItem ItemRoot = new RootCatalogItem();
m_HookHelper.RootCatalogItem = ItemRoot;
TreeListNode nodeRoot = treeList.AppendNode(new object[] { ItemRoot.Name }, null);
nodeRoot.Tag = ItemRoot;
nodeRoot.ImageIndex = 17;
nodeRoot.SelectImageIndex = 18;
BandEvent(nodeRoot, ItemRoot);
ExpandNode(nodeRoot,true);
}
示例4: TreeDataBind
private void TreeDataBind(List<BOM_Struct> list, TreeList treeList)
{
treeList.Nodes.Clear();
TreeListNode parentNode = null;
var parentList = list.FindAll(s => s.Parent_Id == 0);
foreach (var p in parentList)
{
var m = productStructService.GetMaterialById(p.Material_Id);
parentNode = treeList.AppendNode(new object[] { p.Material_Id, p.Id, p.BOM_Id, p.Parent_Id, m.No + "," + m.Version + "," + m.Name + "," + "1000" }, 0);
GetChildNode(parentNode, p.Id, list);
}
treeList.ExpandAll();
if (treeList.FocusedNode == null) return;
var _materialId = Convert.ToInt32(treeList.FocusedNode.GetValue("Material_Id"));
var material = productStructService.GetMaterialById(_materialId);
MaterialDataLoad(material);
DocumentDataLoad(material);
}
示例5: TreeDataBind
private void TreeDataBind(List<BOM_Struct> list, TreeList treeList)
{
Stopwatch watch = new Stopwatch();
watch.Start();
//var dt = new DataTable();
//treeList.Nodes.Clear();
//treeList.DataSource = null;
////FillData(dt);
//treeList.DataSource = FillData(structList);
//treeList.KeyFieldName = "Id";
//treeList.ParentFieldName = "Parent_Id";
treeList.Nodes.Clear();
TreeListNode parentNode = null;
var parentList = list.FindAll(s => s.Parent_Id == 0);
foreach (var p in parentList)
{
var m = productStructService.GetMaterialById(p.Material_Id);
parentNode = treeList.AppendNode(new object[] { p.Material_Id, p.Id, p.BOM_Id, p.Parent_Id, m.No + "," + m.Version + "," + m.Name + "," + "1000" }, 0);
GetChildNode(parentNode, p.Id, list);
}
treeList.ExpandAll();
watch.Stop();
string time = watch.ElapsedMilliseconds.ToString();
//MessageBox.Show(time);
if (treeList.FocusedNode == null) return;
MaterialId = Convert.ToInt32(treeList.FocusedNode.GetValue("Material_Id"));
var material = Material(MaterialId);
MaterialDataLoad(material);
DocumentDataLoad(material);
}
示例6: GetSubRulesSource
private object GetSubRulesSource(TreeListNode node)
{
TreeList tempList = null;
if (node.Level==0)
{
tempList=new TreeList();
TreeListColumn col = tempList.Columns.Add();
col.Caption = "�������";
col.Name = "TypeName";
col.FieldName = "TypeName";
col.Visible = true;
col.OptionsColumn.AllowEdit = false;
col = tempList.Columns.Add();
col.Caption = "�������";
col.Name = "RuleCount";
col.FieldName = "RuleCount";
col.Visible = true;
col.OptionsColumn.AllowEdit = false;
TreeListNode rootNode = tempList.AppendNode(new object[] { "root", "0"}, null);
//rootNode.StateImageIndex = 0;
AppendTreeNodes(tempList, m_CurrTemplateRules.ClassifyRules, rootNode);
return rootNode;
}
else if (node.HasChildren)
{
tempList = new TreeList();
TreeListColumn col = tempList.Columns.Add();
col.Caption = "�������";
col.Name = "TypeName";
col.FieldName = "TypeName";
col.Visible = true;
col.OptionsColumn.AllowEdit = false;
col = tempList.Columns.Add();
col.Caption = "�������";
col.Name = "RuleCount";
col.FieldName = "RuleCount";
col.Visible = true;
col.OptionsColumn.AllowEdit = false;
//����һ���������ڵ�
AppendTreeNodes(tempList, m_CurrTemplateRules.ClassifyRules, null, node["RuleName"].ToString());
return tempList.Nodes.FirstNode;
}
else
{
if (RulesDt == null || RulesDt.Rows.Count == 0) return null;
DataRow[] drs = RulesDt.Select(string.Format("ChkTypeName='{0}'", node["RuleName"]));
if (drs == null || drs.Length == 0)
{
return null;
}
DataTable tempTable = new DataTable();
tempTable = drs[0].Table.Clone();
foreach (DataRow dr in drs)
{
tempTable.ImportRow(dr);
}
return tempTable;
}
}
示例7: GetSubResultsSource
private object GetSubResultsSource(TreeListNode node)
{
TreeList tempList = null;
if (node.Level == 0)
{
tempList = new TreeList();
TreeListColumn col = tempList.Columns.Add();
col.Caption = "�������";
col.Name = "TypeName";
col.FieldName = "TypeName";
col.Visible = true;
col.OptionsColumn.AllowEdit = false;
col = tempList.Columns.Add();
col.Caption = "�������";
col.Name = "ErrCount";
col.FieldName = "ErrCount";
col.Visible = true;
col.OptionsColumn.AllowEdit = false;
TreeListNode rootNode = tempList.AppendNode(new object[] { "root", "0" }, null);
//rootNode.StateImageIndex = 0;
AddNode(tempList,node.Nodes, rootNode);
return rootNode;
}
else if (node.HasChildren)
{
tempList = new TreeList();
TreeListColumn col = tempList.Columns.Add();
col.Caption = "�������";
col.Name = "TypeName";
col.FieldName = "TypeName";
col.Visible = true;
col.OptionsColumn.AllowEdit = false;
col = tempList.Columns.Add();
col.Caption = "�������";
col.Name = "ErrCount";
col.FieldName = "ErrCount";
col.Visible = true;
col.OptionsColumn.AllowEdit = false;
//����һ���������ڵ�
TreeListNode rootNode = tempList.AppendNode(new object[] { node["RuleName"], node["rulesCount"] }, null);
//rootNode.StateImageIndex = 0;
AddNode(tempList, node.Nodes, rootNode);
return tempList.Nodes.FirstNode;
}
else
{
if (m_RuleType == RuleShowType.DefualtType)
{
if (ResultsDt == null || ResultsDt.Rows.Count == 0) return null;
DataTable tempTable = new DataTable();
DataRow[] drs = ResultsDt.Select(string.Format("CheckType='{0}'", node["RuleName"]));
if (drs == null || drs.Length == 0)
{
tempTable = ResultsDt.Clone();
return tempTable;
}
tempTable = drs[0].Table.Clone();
foreach (DataRow dr in drs)
{
tempTable.ImportRow(dr);
}
return tempTable;
}
else
{
if (LayersResultsDt == null || LayersResultsDt.Rows.Count == 0) return null;
DataRow[] drs = LayersResultsDt.Select(string.Format("targetfeatclass1='{0}'", node["CheckType"]));
if (drs == null || drs.Length == 0)
{
return null;
}
DataTable tempTable = new DataTable();
tempTable = drs[0].Table.Clone();
foreach (DataRow dr in drs)
{
tempTable.ImportRow(dr);
}
return tempTable;
}
}
}
示例8: AppendTreeNodes
private void AppendTreeNodes(TreeList treeList, List<ClassifyRule> rules, TreeListNode parentNode)
{
if (rules.Count == 0) return;
foreach (ClassifyRule rule in rules)
{
TreeListNode node = treeList.AppendNode(new object[] { rule.ruleName, rule.SubRulesCount }, parentNode);
node.Checked = treeList.OptionsView.ShowCheckBoxes;
//if (rule.SubRules.Count==0)
//{
// AddTemplateRuleToTree(treeList, rule.ruleName, node);
//}
AppendTreeNodes(treeList,rule.SubRules, node);
}
}
示例9: AddTemplateRuleToTree
private void AddTemplateRuleToTree(TreeList treList, string ruleName, TreeListNode parentNode)
{
if (RulesDt == null || RulesDt.Rows.Count == 0) return;
DataRow[] drs = RulesDt.Select(string.Format("ChkTypeName='{0}'", ruleName));
if (drs == null || drs.Length == 0)
{
return;
}
foreach (DataRow dr in drs)
{
treList.AppendNode(new object[] { dr["ChkTypeName"], 1 }, parentNode);
}
return;
}
示例10: AddNode
private void AddNode(TreeList tree, TreeListNodes nodeSource, TreeListNode nodeParent)
{
foreach (DevExpress.XtraTreeList.Nodes.TreeListNode nodeSub in nodeSource)
{
object[] objValues = new object[2];
objValues[0] = nodeSub.GetValue("RuleName");
objValues[1] = nodeSub.GetValue("rulesCount");
TreeListNode nodeCurrent = tree.AppendNode(objValues, nodeParent);
if (nodeSub.HasChildren)
{
AddNode(tree, nodeSub.Nodes, nodeCurrent);
}
}
}
示例11: SetTreeNode
/// <summary>
/// 根据数据记录设置树节点,有则直接返回无则添加节点
/// </summary>
/// <param name="trv">树控件</param>
/// <param name="dr">数据记录</param>
/// <param name="txtfld">文本字段</param>
/// <param name="cardNo">卡号</param>
/// <param name="idfld">键值字段</param>
/// <param name="pidfld">父键字段</param>
/// <param name="tagformat">附加tag标签属性值格式:对其中{字段名称}替换具体值,没有该字段则不替换</param>
/// <returns>返回数据记录对应的树节点</returns>
public static TreeListNode SetTreeNode(TreeList trv, DataRow dr, string txtfld,string cardNo, string idfld, string pidfld, string tagformat)
{
//检查传入参数
if (null == trv || null == dr || string.IsNullOrEmpty(txtfld) || string.IsNullOrEmpty(idfld) || string.IsNullOrEmpty(cardNo))
return null;
DataTable tab = dr.Table;
if (!tab.Columns.Contains(txtfld) || !tab.Columns.Contains(idfld) || !tab.Columns.Contains(cardNo))
return null;
if (!string.IsNullOrEmpty(pidfld) && !tab.Columns.Contains(pidfld))
return null;
if (DBNull.Value == dr[idfld])
return null;
//有则直接返回
string key = Convert.ToString(dr[idfld]);
// TreeNode[] trns = trv.Nodes.Find(key, true);
foreach (TreeListNode nd in trv.Nodes)
{
TreeListNode trns = trv.FindNodeByFieldValue("id", dr["id"].ToString());
if (trns != null)
{
return trns;
}
}
//没有节点则增加,递归处理父节点
DataRow pdr = null;
TreeListNode trn = null, ptrn = null;
if (!string.IsNullOrEmpty(pidfld) && DBNull.Value != dr[pidfld])
{
object pobj = dr[pidfld];
for (int i = 0, len = tab.Rows.Count; i < len; i++)
{
if (!pobj.Equals(tab.Rows[i][idfld]))
continue;
pdr = tab.Rows[i];
break;
}
}
if (null != pdr)
ptrn = BindManager.SetTreeNode(trv, pdr, txtfld, cardNo,idfld, pidfld, tagformat);
if (null == ptrn)
{
if (dr[cardNo].ToString() != string.Empty)
{
trn = trv.AppendNode(new object[] { Convert.ToString(dr[txtfld]) + "(" + Convert.ToString(dr[cardNo]) + ")", Convert.ToString(dr[idfld]) }, null, key);
}
else
{
trn = trv.AppendNode(new object[] { Convert.ToString(dr[txtfld]), Convert.ToString(dr[idfld]) }, null, key);
}
trn.ImageIndex = 1;
trn.SelectImageIndex =1;
}
else
{
if (dr[cardNo].ToString() != string.Empty)
{
trn = trv.AppendNode(new object[] { Convert.ToString(dr[txtfld]) + "(" + Convert.ToString(dr[cardNo]) + ")", Convert.ToString(dr[idfld]) }, ptrn, key);
}
else
{
trn = trv.AppendNode(new object[] { Convert.ToString(dr[txtfld]), Convert.ToString(dr[idfld]) }, ptrn, key);
}
trn.ImageIndex = 2;
trn.SelectImageIndex = 2;
}
//附加tag标签值
if (string.IsNullOrEmpty(tagformat))
return trn;
DataColumnCollection cols = tab.Columns;
foreach (DataColumn col in cols)
{
string fld = col.ColumnName;
string val = "";
if (DBNull.Value != dr[fld])
val = Convert.ToString(dr[fld]);
tagformat = tagformat.Replace("{" + fld + "}", val);
}
trn.Tag = tagformat;
return trn;
}