本文整理汇总了C#中System.Windows.Forms.TreeNode.ExpandAll方法的典型用法代码示例。如果您正苦于以下问题:C# TreeNode.ExpandAll方法的具体用法?C# TreeNode.ExpandAll怎么用?C# TreeNode.ExpandAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.TreeNode
的用法示例。
在下文中一共展示了TreeNode.ExpandAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddNode
private void AddNode(IDictionary<string, object> dictionary, TreeNode node)
{
if (dictionary.Count == 0)
{
node.Nodes.Add("{}");
}
else
{
foreach (var pair in dictionary)
{
var key = pair.Key;
if (pair.Value is IDictionary<string, object>)
{
var n = new TreeNode(pair.Key);
node.Nodes.Add(n);
AddNode(pair.Value, n);
}
else if (pair.Value is IList<object>)
{
var n = new TreeNode("[] " + pair.Key);
node.Nodes.Add(n);
AddNode((IList<object>)pair.Value, n);
}
else
{
// todo: differentiate null
node.Nodes.Add(string.Format("{0} : {1}", pair.Key, pair.Value));
}
node.ExpandAll();
}
}
}
示例2: BindTreeList
private void BindTreeList(List<CorePointData> lstTempCorePointData)
{
treeViewList.Nodes.Clear();
if (lstTempCorePointData != null && lstTempCorePointData.Count > 0)
{
lstCorePointData = new List<CorePointData>();
foreach (CorePointData data in lstTempCorePointData)
{
lstCorePointData.Add(data);
}
}
if (lstCorePointData != null && lstCorePointData.Count > 0)
{
TreeNode node = new TreeNode("重心包线");
treeViewList.Nodes.Add(node);
foreach (CorePointData data in lstCorePointData)
{
TreeNode childNode = new TreeNode();
childNode.Name = data.pointName;
childNode.Text = data.pointName;
childNode.ToolTipText = data.pointXValue.ToString() + "," + data.pointYValue.ToString();
node.Nodes.Add(childNode);
}
node.ExpandAll();
}
}
示例3: SetNodeStyle
private static void SetNodeStyle(TreeNode Node)
{
int nNodeCount = 0;
if (Node.Nodes.Count != 0)
{
foreach (TreeNode tnTemp in Node.Nodes)
{
if (tnTemp.Checked == true)
nNodeCount++;
}
if (nNodeCount == Node.Nodes.Count)
{
Node.Checked = true;
Node.ExpandAll();
Node.ForeColor = Color.Black;
}
else if (nNodeCount == 0)
{
Node.Checked = false;
Node.Collapse();
Node.ForeColor = Color.Black;
}
else
{
Node.Checked = true;
Node.ForeColor = Color.Gray;
}
}
//当前节点选择完后,判断父节点的状态,调用此方法递归。
if (Node.Parent != null)
SetNodeStyle(Node.Parent);
}
示例4: MainWindow
public MainWindow()
{
InitializeComponent();
phone_book_root_node = tv_PhoneBook.Nodes["phone_book_root_node"];
sessions_root_node = tv_Sessions.Nodes["sessions_root_node"];
internal_root_node = sessions_root_node.Nodes["internal_root_node"];
external_root_node = sessions_root_node.Nodes["external_root_node"];
inbound_root_node = sessions_root_node.Nodes["inbound_root_node"];
outbound_root_node = sessions_root_node.Nodes["outbound_root_node"];
sessions_root_node.ExpandAll();
talk_duration_less_than_a_minute = new DataPoint { Name = "LessThenAMinute", LegendText = "Talk < 1 min", YValues = new[] { 0.0 }, Color = Color.FromArgb(100, 180, 100) };
c_UserChart.Series[USER_STATES].Points.Add(talk_duration_less_than_a_minute);
talk_duration_over_a_minute = new DataPoint { Name = "OverAMinute", LegendText = "Talk >= 1 min", YValues = new[] { 0.0 }, Color = Color.FromArgb(180, 80, 80) };
c_UserChart.Series[USER_STATES].Points.Add(talk_duration_over_a_minute);
SetState(LoginState.LoggedOut);
presenter = new MainWindowPresenter(this, SimpleIOCContainer.Instance.Resolve<IOPSClient>());
c_Statistics.Series[NUMBER_OF_SESSIONS].Points.AddXY(0, 0);
c_Statistics.Series[NUMBER_OF_DROPPED_SESSIONS].Points.AddXY(0, 0);
presenter.Connect();
t_Timer.Start();
}
示例5: SetInitialExpansion
private void SetInitialExpansion(TreeNode treeNode)
{
if (_view.Tree.VisibleCount >= treeNode.GetNodeCount(true))
treeNode.ExpandAll();
else
CollapseToFixtures(treeNode);
}
示例6: ShowProcessWaitChains
private void ShowProcessWaitChains(WaitChainTraversal wct, bool showAllData)
{
var threads = Windows.GetProcessThreads(processPid);
if (threads == null)
{
PhUtils.ShowWarning(string.Format("The process ID {0} does not exist", processPid));
this.Close();
}
textDescription.AppendText(string.Format("Process: {0}, PID: {1}", processName, processPid));
threadNode = threadTree.Nodes.Add(string.Format("Process: {0}, PID: {1}", processName, processPid));
foreach (var thread in threads)
{
//Get the wait chains for this thread.
int currThreadId = thread.Key;
WaitData data = wct.GetThreadWaitChain(currThreadId);
if (data != null)
{
DisplayThreadData(data, showAllData);
}
else //This happens when running without admin rights.
{
threadNode.Nodes.Add(string.Format("TID:{0} Unable to retrieve wait chains for this thread without Admin rights", currThreadId));
threadNode.ExpandAll();
}
}
}
示例7: pTreeViewDataBanding
private void pTreeViewDataBanding(TreeNode node,List<Precondition> childs)
{
if (node != null && childs != null && childs.Count > 0)
{
foreach (var item in childs)
{
TreeNode child = new TreeNode(item.name + "(" + item.type + ")");
node.Nodes.Add(child);
if (item.child != null && item.child.Count > 0)
{
this.pTreeViewDataBanding(child, item.child);
child.ExpandAll();
}
}
}
else
{
TreeNode root = new TreeNode(this.precondition.name + "(" + this.precondition .type + ")");
this.pTreeView.Nodes.Add(root);
if (this.precondition.child != null && this.precondition.child.Count > 0)
{
this.pTreeViewDataBanding(root, this.precondition.child);
root.ExpandAll();
}
}
}
示例8: SettingsForm
public SettingsForm(
PluginRepository plugins,
GuiConfigurablePluginInfo generalSettingsInfo,
IEnumerable<GuiConfigurablePluginInfo> guiPluginInfos)
{
this.plugins = plugins;
InitializeComponent();
var generalSettingsPanel = generalSettingsInfo.PluginSettingsPanel;
var generalSettingsNode = new TreeNode(generalSettingsInfo.PluginName) { Tag = generalSettingsPanel };
settingsTreeView.Nodes.Add(generalSettingsNode);
foreach (var plugin in guiPluginInfos)
{
var settingsNode = new TreeNode(plugin.PluginName) { Tag = plugin.PluginSettingsPanel };
if(plugin.PluginIcon != null)
{
treeviewImages.Images.Add(plugin.PluginIcon);
settingsNode.ImageIndex = treeviewImages.Images.Count - 1;
settingsNode.SelectedImageIndex = treeviewImages.Images.Count - 1;
}
generalSettingsNode.Nodes.Add(settingsNode);
}
settingsTreeView.SelectedNode = generalSettingsNode;
generalSettingsNode.ExpandAll();
panel.Controls.Add(generalSettingsPanel);
CreateHandle();
}
示例9: AddLabelOnClick
private void AddLabelOnClick(object sender, EventArgs e)
{
if (this.nodeMouseClickSelectedNode.Level == 0)
{
var treeNode = new TreeNode("NewHost");
this.nodeMouseClickSelectedNode.Nodes.Add(treeNode);
treeNode.ExpandAll();
treeNode.BeginEdit();
}
}
示例10: PrepareFavoritesPane
public void PrepareFavoritesPane()
{
SqlCommon.SqlForm.treeFavorites.BeginUpdate();
SqlCommon.SqlForm.treeFavorites.Nodes.Clear();
SqlCommon.SqlForm.treeFavorites.Nodes.Add(_favoritesTree = new NodeRoot("Favoritter", SqlGuiForm.IconFavorites));
_favoritesTree.Nodes.Add(_favoriteTables = new NodeFolder("Tabeller"));
_favoritesTree.Nodes.Add(_favoriteViews = new NodeFolder("Views"));
_favoritesTree.Nodes.Add(_favoriteSqls = new NodeFolder("SQL-uttrykk"));
_favoritesTree.ExpandAll();
SqlCommon.SqlForm.treeFavorites.EndUpdate();
}
示例11: ReceiveFlowTokenList
public void ReceiveFlowTokenList(IEnumerable<FlowToken> data)
{
treeFlowToken.BeginUpdate();
treeFlowToken.Nodes.Clear();
foreach (var d in data) {
var node = new TreeNode();
node.Text = d.TokenType.ToString();
node.Nodes.Add(d.Content);
node.Nodes.Add("Position: " + d.Position.ToString());
node.Nodes.Add("Length: " + d.Length.ToString());
node.ExpandAll();
treeFlowToken.Nodes.Add(node);
}
treeFlowToken.EndUpdate();
}
示例12: FillTree
/// <summary>
/// Function to fill ledgers as TreeMode
/// </summary>
/// <param name="tn"></param>
public void FillTree(TreeNode tn)
{
try
{
List<DataTable> ListObj = new List<DataTable>();
AccountGroupBll bllAccountGroup = new AccountGroupBll();
ListObj = bllAccountGroup.AccountGroupViewAllByGroupUnder(Convert.ToDecimal(tn.Name));
AccountLedgerBll bllAccountLedger = new AccountLedgerBll();
if (ListObj[0].Rows.Count > 0)
{
foreach (DataRow dr in ListObj[0].Rows)
{
tn.Nodes.Add(dr["accountGroupId"].ToString(), dr["accountGroupName"].ToString());
tn.ExpandAll();
if (tn.LastNode != null)
{
tn.LastNode.ForeColor = Color.Red;
}
else
{
tn.LastNode.ForeColor = Color.Blue;
}
}
foreach (TreeNode tn1 in tn.Nodes)
{
FillTree(tn1);
List<DataTable> ListObjLedger= bllAccountLedger.AccountLedgerViewAllByLedgerName(Convert.ToDecimal(tn1.Name));
foreach (DataRow dr in ListObjLedger[0].Rows)
{
tn1.Nodes.Add(dr["ledgerId"].ToString(), dr["ledgerName"].ToString());
tn1.ExpandAll();
if (tn1.LastNode != null)
{
tn1.LastNode.ForeColor = Color.Blue;
}
else
{
tn.LastNode.ForeColor = Color.Red;
}
}
}
}
}
catch (Exception ex)
{
MessageBox.Show("COA:1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
示例13: FillTree
/// <summary>
/// Function to fill ledgers as TreeMode
/// </summary>
/// <param name="tn"></param>
public void FillTree(TreeNode tn)
{
try
{
DataTable dtb = new DataTable();
AccountGroupSP spAccountGroup = new AccountGroupSP();
dtb = spAccountGroup.AccountGroupViewAllByGroupUnder(Convert.ToDecimal(tn.Name));
AccountLedgerSP ledgerSP = new AccountLedgerSP();
if (dtb.Rows.Count > 0)
{
foreach (DataRow dr in dtb.Rows)
{
tn.Nodes.Add(dr["accountGroupId"].ToString(), dr["accountGroupName"].ToString());
tn.ExpandAll();
if (tn.LastNode != null)
{
tn.LastNode.ForeColor = Color.Red;
}
else
{
tn.LastNode.ForeColor = Color.Blue;
}
}
foreach (TreeNode tn1 in tn.Nodes)
{
FillTree(tn1);
DataTable dtb1 = ledgerSP.AccountLedgerViewAllByLedgerName(Convert.ToDecimal(tn1.Name));
foreach (DataRow dr in dtb1.Rows)
{
tn1.Nodes.Add(dr["ledgerId"].ToString(), dr["ledgerName"].ToString());
tn1.ExpandAll();
if (tn1.LastNode != null)
{
tn1.LastNode.ForeColor = Color.Blue;
}
else
{
tn.LastNode.ForeColor = Color.Red;
}
}
}
}
}
catch (Exception ex)
{
MessageBox.Show("COA:1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
示例14: OpenFile
public void OpenFile(string filename)
{
BinaryReader b_reader = new BinaryReader(new FileStream(filename, FileMode.Open));
BfsBinaryReader.Endianness endianness;
if(schema.ByteOrder.ByteOrder == BfsByteOrderEnum.BigEndian)
endianness = BfsBinaryReader.Endianness.BigEndian;
else
endianness = BfsBinaryReader.Endianness.LittleEndian;
reader = new BfsBinaryReader(b_reader, endianness);
TreeNode rootNode = new TreeNode(schema.FormatBlock.Name);
treeView1.Nodes.Add(rootNode);
ReadDataBlock(schema.FormatBlock, rootNode);
rootNode.ExpandAll();
}
示例15: CreatTree
TreeNode rootNode = null; //treeview的根节点
#endregion Fields
#region Methods
//DataTable dtDocFileList = null;//文档清单列表
/// <summary>
///
/// </summary>
/// <param name="Nds"></param>
/// <param name="parentID"></param>
/// <param name="dt"></param>
public void CreatTree(TreeNodeCollection Nds, string parentID, DataTable dt)
{
//DataView dv = new DataView();
TreeNode tmpNode;
//dv.Table = dt;
//dv.RowFilter = "上级单位ID='" + parentID + "'";
DataRow[] dv = dt.Select(string.Format("DFD_PARENT_DIR_ID='{0}'", parentID));
foreach (DataRow drv in dv)
{
tmpNode = new TreeNode();
tmpNode.Text = drv["DFD_PATH_NAME"].ToString();
tmpNode.Tag = drv["DFD_ID"].ToString();
tmpNode.ExpandAll();
Nds.Add(tmpNode);
CreatTree(tmpNode.Nodes, tmpNode.Tag.ToString(), dt);
}
}