Exemple #1
0
 /// <summary>method initialize grid
 /// </summary>
 /// <param name="grid">grid being initialized</param>
 /// <param name="colWidth">array of column's width in GridLength units</param>
 /// <param name="rowCount">rows count</param>
 /// <param name="gridWidth">optional grid width in inches</param>
 /// <param name="margin">optional grid margin</param>
 public static void SetupGrid(Grid grid, GridLength[] colWidth, int rowCount, double gridWidth = 0.0, Thickness? margin = null)
 {
     int i;
     int colCount = colWidth.GetLength(0);
     for (i = 0; i < colCount; i++)
     {
         grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = colWidth[i] });
     }
     for (i = 0; i < rowCount; i++)
     {
         grid.RowDefinitions.Add(new RowDefinition());
     }
     if (gridWidth > 0.0) grid.Width = gridWidth * ReportPage.DisplayResolution;
     if(margin.HasValue) grid.Margin = (Thickness)margin;
 }