Exemple #1
0
 public void ExpandToLevel(int level, ProgresEvent evprogres)
 {
     try
     {
         if (level <= 0)
         {
             CollapseAll(evprogres);
             return;
         }
         else
         {
             CollapseAll(evprogres);
         }
         int rowindex = 0;
         while (rowindex < Rows.Count)
         {
             DataGridViewRow nrow = Rows[rowindex];
             if (nrow is TreeGridNode)
             {
                 DataGridViewRow nextnode = null;
                 if ((rowindex + 1) < Rows.Count)
                 {
                     nextnode = Rows[rowindex + 1];
                 }
                 TreeGridNode xnode = (TreeGridNode)nrow;
                 ExpandChilds(xnode, 1, level);
                 if (evprogres != null)
                 {
                     bool docancel = false;
                     evprogres(rowindex, Rows.Count, ref docancel);
                     if (docancel)
                     {
                         break;
                     }
                 }
                 if (nextnode != null)
                 {
                     rowindex = nextnode.Index;
                 }
                 else
                 {
                     break;
                 }
             }
             else
             {
                 rowindex++;
             }
         }
     }
     finally
     {
         if (evprogres != null)
         {
             bool docancel = false;
             evprogres(RowCount, RowCount, ref docancel);
         }
     }
 }
Exemple #2
0
        public void ExpandAll(ProgresEvent evprogres)
        {
            try
            {
                int rowindex = 0;
                SuspendLayout();
                int totalcount = 0;
                while (rowindex < Rows.Count)
                {
                    DataGridViewRow nrow = Rows[rowindex];
                    if (nrow is TreeGridNode)
                    {
                        DataGridViewRow nextnode = null;
                        if ((rowindex + 1) < Rows.Count)
                        {
                            nextnode = Rows[rowindex + 1];
                        }
                        TreeGridNode xnode = (TreeGridNode)nrow;
                        ExpandChilds(xnode, 1, 999999);

                        if (evprogres != null)
                        {
                            totalcount++;
                            if ((totalcount % 10) == 0)
                            {
                                bool docancel = false;
                                evprogres(rowindex, Rows.Count, ref docancel);
                                if (docancel)
                                {
                                    break;
                                }
                            }
                        }
                        if (nextnode != null)
                        {
                            rowindex = nextnode.Index;
                        }
                        else
                        {
                            break;
                        }
                    }
                    else
                    {
                        rowindex++;
                    }
                }
                ResumeLayout(true);
            }
            finally
            {
                if (evprogres != null)
                {
                    bool docancel = false;
                    evprogres(RowCount, RowCount, ref docancel);
                }
            }
        }
Exemple #3
0
 public void CollapseAll(ProgresEvent evprogres)
 {
     try
     {
         int rowindex = 0;
         while (rowindex < Rows.Count)
         {
             DataGridViewRow nrow = Rows[rowindex];
             if (nrow is TreeGridNode)
             {
                 TreeGridNode xnode = (TreeGridNode)nrow;
                 if (xnode.IsExpanded)
                 {
                     xnode.Collapse();
                 }
                 CollapseInvisibleChilds(xnode);
                 rowindex++;
                 if (evprogres != null)
                 {
                     bool docancel = false;
                     evprogres(rowindex, Rows.Count, ref docancel);
                     if (docancel)
                     {
                         break;
                     }
                 }
             }
             else
             {
                 rowindex++;
             }
         }
     }
     finally
     {
         if (evprogres != null)
         {
             bool docancel = false;
             evprogres(RowCount, RowCount, ref docancel);
         }
     }
 }