当前位置: 首页>>代码示例>>C#>>正文


C# TreeNode.AssignIsExpanded方法代码示例

本文整理汇总了C#中TreeNode.AssignIsExpanded方法的典型用法代码示例。如果您正苦于以下问题:C# TreeNode.AssignIsExpanded方法的具体用法?C# TreeNode.AssignIsExpanded怎么用?C# TreeNode.AssignIsExpanded使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TreeNode的用法示例。


在下文中一共展示了TreeNode.AssignIsExpanded方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddRows

        void AddRows(ChartOfAccounts tree, DataTable dt, bool ClearRows)
        {
            if (ClearRows)
            {
                Rows = new ObservableCollectionAdv<TreeNode>();
                _root = new TreeNode();
                _root.Tree = this;
                _root.Children = new TreeNode.NodeCollection(_root);
                _root.Nodes = new ReadOnlyCollection<TreeNode>(_root.Children);
                tree.lstParents = new List<TreeNode>();
                tree.AllTreeNodes = new List<TreeNode>();
            }

            int ColumnCount = dt.Columns.Count - 4;
            int i = tree.Rows.Count;
            for (; i < dt.Rows.Count; i++)
            {
                TreeNode node = new TreeNode();
                node.Tree = tree;
                node.Children = new TreeNode.NodeCollection(node);
                node.Nodes = new ReadOnlyCollection<TreeNode>(node.Children);

                node.IsExpandedOnce = true;
                node.AssignIsExpanded(true);

                node.Id = Convert.ToInt32(dt.Rows[i][0].ToString());

                node.IsGroup = Convert.ToBoolean(dt.Rows[i]["IsGroup"].ToString());
                node.LevelNo = Convert.ToInt16(dt.Rows[i]["Depth"].ToString());
                //node.NodeIndex = dt.Rows[i]["NodeIndex"].ToString();

                if (ColumnCount > 0)
                    node.Field1 = dt.Rows[i][1].ToString();
                if (ColumnCount > 1)
                    node.Field2 = dt.Rows[i][2].ToString();
                if (ColumnCount > 2)
                    node.Field3 = dt.Rows[i][3].ToString();
                if (ColumnCount > 3)
                    node.Field4 = dt.Rows[i][4].ToString();
                if (ColumnCount > 4)
                    node.Field5 = dt.Rows[i][5].ToString();
                if (ColumnCount > 5)
                    node.Field6 = dt.Rows[i][6].ToString();

                if (node.IsGroup)
                    node.ColorBrush = tree.GroupColorBrush;
                else
                    node.ColorBrush = tree.ItemColorBrush;

                tree.Rows.Add(node);
                tree.AllTreeNodes.Add(node);

                if (node.IsGroup)
                {
                    if (tree.lstParents.Count > 0)
                    {
                        if (node.LevelNo > tree.lstParents[tree.lstParents.Count - 1].LevelNo)
                        {
                            tree.lstParents[tree.lstParents.Count - 1].Children.Add(node);
                            tree.lstParents.Add(node);
                        }
                        else if (node.LevelNo == tree.lstParents[tree.lstParents.Count - 1].LevelNo)
                        {

                            tree.lstParents.RemoveAt(tree.lstParents.Count - 1);
                            tree.lstParents[tree.lstParents.Count - 1].Children.Add(node);
                            tree.lstParents.Add(node);
                        }
                        else if (node.LevelNo < tree.lstParents[tree.lstParents.Count - 1].LevelNo)
                        {
                            for (int j = tree.lstParents.Count - 1; j >= 0; j--)
                            {
                                if (node.LevelNo <= tree.lstParents[j].LevelNo)
                                {
                                    tree.lstParents.RemoveAt(tree.lstParents.Count - 1);
                                }
                                else
                                    break;
                            }
                            tree.lstParents[tree.lstParents.Count - 1].Children.Add(node);
                            tree.lstParents.Add(node);
                        }
                    }
                    else
                        tree.lstParents.Add(node);
                }
                else
                {
                    if (node.LevelNo > tree.lstParents[tree.lstParents.Count - 1].LevelNo)
                    {
                        tree.lstParents[tree.lstParents.Count - 1].Children.Add(node);
                    }
                    else if (node.LevelNo == tree.lstParents[tree.lstParents.Count - 1].LevelNo)
                    {
                        for (int j = tree.lstParents.Count - 1; j >= 0; j--)
                        {
                            if (node.LevelNo <= tree.lstParents[j].LevelNo)
                            {
                                tree.lstParents.RemoveAt(tree.lstParents.Count - 1);
                            }
//.........这里部分代码省略.........
开发者ID:merlin2504,项目名称:RD12,代码行数:101,代码来源:ChartOfAccounts.xaml.cs

示例2: SetIsExpanded

		internal void SetIsExpanded(TreeNode node, bool value)
		{
			if (value)
			{
				if (!node.IsExpandedOnce)
				{
					node.IsExpandedOnce = true;
					node.AssignIsExpanded(value);
					CreateChildrenNodes(node);
				}
				else
				{
					node.AssignIsExpanded(value);
					CreateChildrenRows(node);
				}
			}
			else
			{
				DropChildrenRows(node, false);
				node.AssignIsExpanded(value);
			}
		}
开发者ID:DinrusGroup,项目名称:D-IDE,代码行数:22,代码来源:TreeList.cs

示例3: Filter

        public void Filter(string Condition)
        {
            List<TreeNode> templstParents = new List<TreeNode>();
            int ColumnCount = DataSource.Columns.Count - 19;
            DataRow[] drr = DataSource.Select(Condition);
            Rows.Clear();
            for (int i = 0; i < drr.Count(); i++)
            {
                TreeNode node = new TreeNode();
                node.Tree = tree1;
                node.Children = new TreeNode.NodeCollection(node);
                node.Nodes = new ReadOnlyCollection<TreeNode>(node.Children);

                node.IsExpandedOnce = true;
                node.AssignIsExpanded(true);

                node.NodeNo = i;

                node.Id = Convert.ToInt32(drr[i][0].ToString());

                node.IsGroup = Convert.ToBoolean(drr[i]["IsGroup"].ToString());
                node.LevelNo = Convert.ToInt16(drr[i]["LevelNo"].ToString());
                node.NodeIndex = drr[i]["NodeIndex"].ToString();

                if (ColumnCount > 0)
                    node.Field1 = drr[i][1].ToString();
                if (ColumnCount > 1)
                    node.Field2 = drr[i][2].ToString();
                if (ColumnCount > 2)
                    node.Field3 = drr[i][3].ToString();
                if (ColumnCount > 3)
                    node.Field4 = drr[i][4].ToString();
                if (ColumnCount > 4)
                    node.Field5 = drr[i][5].ToString();
                if (ColumnCount > 5)
                    node.Field6 = drr[i][6].ToString();

                if (node.IsGroup)
                    node.ColorBrush = GroupColorBrush;
                else
                    node.ColorBrush = ItemColorBrush;

                Rows.Add(node);
                AllTreeNodes.Add(node);

                if (node.IsGroup)
                {
                    if (templstParents.Count > 0)
                    {
                        if (node.LevelNo > templstParents[templstParents.Count - 1].LevelNo)
                        {
                            templstParents[templstParents.Count - 1].Children.Add(node);
                            templstParents.Add(node);
                        }
                        else if (node.LevelNo == templstParents[templstParents.Count - 1].LevelNo)
                        {

                            templstParents.RemoveAt(templstParents.Count - 1);
                            templstParents[templstParents.Count - 1].Children.Add(node);
                            templstParents.Add(node);
                        }
                        else if (node.LevelNo < templstParents[templstParents.Count - 1].LevelNo)
                        {
                            for (int j = templstParents.Count - 1; j >= 0; j--)
                            {
                                if (node.LevelNo <= templstParents[j].LevelNo)
                                {
                                    templstParents.RemoveAt(templstParents.Count - 1);
                                }
                                else
                                    break;
                            }
                            templstParents[templstParents.Count - 1].Children.Add(node);
                            templstParents.Add(node);
                        }
                    }
                    else
                        templstParents.Add(node);
                }
                else
                {
                    if (templstParents.Count == 0)
                        continue;

                    if (node.LevelNo > templstParents[templstParents.Count - 1].LevelNo)
                    {
                        templstParents[templstParents.Count - 1].Children.Add(node);
                    }
                    else if (node.LevelNo == templstParents[templstParents.Count - 1].LevelNo)
                    {
                        for (int j = templstParents.Count - 1; j >= 0; j--)
                        {
                            if (node.LevelNo <= templstParents[j].LevelNo)
                            {
                                templstParents.RemoveAt(templstParents.Count - 1);
                            }
                            else
                                break;
                        }
                        templstParents[templstParents.Count - 1].Children.Add(node);
//.........这里部分代码省略.........
开发者ID:merlin2504,项目名称:RD12,代码行数:101,代码来源:ChartOfAccounts.xaml.cs


注:本文中的TreeNode.AssignIsExpanded方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。