void ResetGrid() { lock (this) { if (f != null) { if (f != oldf || f.Modified) { grid.ColumnsCount = 4; grid.RowsCount = f.p.Length + 1; grid[0, 0] = new SourceGrid2.Cells.Real.ColumnHeader("n"); grid[0, 1] = new SourceGrid2.Cells.Real.ColumnHeader("fit"); grid[0, 2] = new SourceGrid2.Cells.Real.ColumnHeader("p[n]"); grid[0, 3] = new SourceGrid2.Cells.Real.ColumnHeader("±Δp[n]"); for (int i = 0; i < f.p.Length; i++) { grid[i + 1, 0] = new SourceGrid2.Cells.Real.RowHeader(i.ToString()); grid[i + 1, 1] = new SourceGrid2.Cells.Real.CheckBox(Fitp[i]); grid[i + 1, 2] = new FpCell(f, i, model); if (CovarianceMatrix == null) { grid[i + 1, 3] = new SourceGrid2.Cells.Real.Cell("", typeof(string)); } else { grid[i + 1, 3] = new SourceGrid2.Cells.Real.Cell(Math.Sqrt(CovarianceMatrix[i, i]), typeof(double)); } grid[i + 1, 3].DataModel.EnableEdit = false; } } plength = f.p.Length; } if (f == null) { grid.RowsCount = 1; grid.ColumnsCount = 4; grid[0, 0] = new SourceGrid2.Cells.Real.ColumnHeader("n"); grid[0, 1] = new SourceGrid2.Cells.Real.ColumnHeader("fit"); grid[0, 2] = new SourceGrid2.Cells.Real.ColumnHeader("p[n]"); grid[0, 3] = new SourceGrid2.Cells.Real.ColumnHeader("±Δp[n]"); Fitp = new bool[0]; } grid.AutoSize(); } }
public void Reset(FunctionItem item) { this.item = item; if (item != null) { grid.ColumnsCount = 2; grid.RowsCount = item.p.Length + 1; grid[0, 0] = new SourceGrid2.Cells.Real.Header("n"); grid[0, 1] = new SourceGrid2.Cells.Real.ColumnHeader("p[n]"); for (int r = 0; r < item.p.Length; r++) { grid[r + 1, 0] = new SourceGrid2.Cells.Real.RowHeader(r); grid[r + 1, 1] = new FpCell(item, r, Model); } grid.Columns[0].AutoSizeMode = SourceGrid2.AutoSizeMode.MinimumSize; grid.Columns[1].AutoSizeMode = SourceGrid2.AutoSizeMode.MinimumSize; grid.AutoSize(); } }