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(); } }
private void frmSample14_Load(object sender, System.EventArgs e) { grid1.BorderStyle = BorderStyle.FixedSingle; grid1.ColumnsCount = 3; //grid1.FixedRows = 1; grid1.Rows.Insert(0); grid1[0, 0] = new SourceGrid2.Cells.Real.ColumnHeader("String"); grid1[0, 1] = new SourceGrid2.Cells.Real.ColumnHeader("DateTime"); grid1[0, 2] = new SourceGrid2.Cells.Real.ColumnHeader("CheckBox"); for (int r = 1; r < 10; r++) { grid1.Rows.Insert(r); grid1[r, 0] = new SourceGrid2.Cells.Real.Cell("Hello " + r.ToString(), typeof(string)); grid1[r, 1] = new SourceGrid2.Cells.Real.Cell(DateTime.Today, typeof(DateTime)); grid1[r, 2] = new SourceGrid2.Cells.Real.CheckBox(true); } grid1.AutoSizeAll(); }
private void Form4_Load(object sender, EventArgs e) { int i; grid1.BorderStyle = BorderStyle.FixedSingle; grid1.ColumnsCount = 5; //grid1.FixedRows = 1; grid1.Rows.Insert(0); if (CComLibrary.GlobeVal.languageselect == 0) { grid1[0, 0] = new SourceGrid2.Cells.Real.ColumnHeader("名称"); grid1[0, 1] = new SourceGrid2.Cells.Real.ColumnHeader("行"); grid1[0, 2] = new SourceGrid2.Cells.Real.ColumnHeader("列"); grid1[0, 3] = new SourceGrid2.Cells.Real.ColumnHeader("文件名称"); grid1[0, 4] = new SourceGrid2.Cells.Real.ColumnHeader("文件日期"); } else { grid1[0, 0] = new SourceGrid2.Cells.Real.ColumnHeader("Name"); grid1[0, 1] = new SourceGrid2.Cells.Real.ColumnHeader("Row"); grid1[0, 2] = new SourceGrid2.Cells.Real.ColumnHeader("Column"); grid1[0, 3] = new SourceGrid2.Cells.Real.ColumnHeader("File name"); grid1[0, 4] = new SourceGrid2.Cells.Real.ColumnHeader("File date"); } for (int r = 1; r < 2; r++) { grid1.Rows.Insert(r); if (CComLibrary.GlobeVal.languageselect == 0) { grid1[r, 0] = new SourceGrid2.Cells.Real.Cell("数据1", typeof(string)); } else { grid1[r, 0] = new SourceGrid2.Cells.Real.Cell("First data", typeof(string)); } grid1[r, 1] = new SourceGrid2.Cells.Real.Cell(CComLibrary.GlobeVal.outgrid[0].Rows.Count.ToString(), typeof(string)); grid1[r, 2] = new SourceGrid2.Cells.Real.Cell(CComLibrary.GlobeVal.outgrid[0].Columns.Count.ToString(), typeof(string)); grid1[r, 3] = new SourceGrid2.Cells.Real.Cell(CComLibrary.GlobeVal.outgrid[0].Tag, typeof(string)); grid1[r, 4] = new SourceGrid2.Cells.Real.Cell(" ", typeof(string)); } for (i = 0; i < grid1.ColumnsCount; i++) { grid1.Columns[i].Width = (grid1.Width - 30) / grid1.ColumnsCount; } //grid1.AutoSizeAll(); grid2.BorderStyle = BorderStyle.FixedSingle; grid2.ColumnsCount = 6; //grid1.FixedRows = 1; grid2.Rows.Insert(0); if (CComLibrary.GlobeVal.languageselect == 0) { grid2[0, 0] = new SourceGrid2.Cells.Real.ColumnHeader("X"); grid2[0, 1] = new SourceGrid2.Cells.Real.ColumnHeader("Y"); grid2[0, 2] = new SourceGrid2.Cells.Real.ColumnHeader("列"); grid2[0, 3] = new SourceGrid2.Cells.Real.ColumnHeader("名称"); grid2[0, 4] = new SourceGrid2.Cells.Real.ColumnHeader("第一个数据"); grid2[0, 5] = new SourceGrid2.Cells.Real.ColumnHeader("位置"); } else { grid2[0, 0] = new SourceGrid2.Cells.Real.ColumnHeader("X"); grid2[0, 1] = new SourceGrid2.Cells.Real.ColumnHeader("Y"); grid2[0, 2] = new SourceGrid2.Cells.Real.ColumnHeader("Column"); grid2[0, 3] = new SourceGrid2.Cells.Real.ColumnHeader("Name"); grid2[0, 4] = new SourceGrid2.Cells.Real.ColumnHeader("First data"); grid2[0, 5] = new SourceGrid2.Cells.Real.ColumnHeader("Postion"); } for (int r = 1; r < CComLibrary.GlobeVal.outgrid[0].ColumnsCount; r++) { grid2.Rows.Insert(r); grid2[r, 0] = new SourceGrid2.Cells.Real.CheckBox(false); grid2[r, 1] = new SourceGrid2.Cells.Real.CheckBox(false); grid2[r, 2] = new SourceGrid2.Cells.Real.Cell(CComLibrary.GlobeVal.outgrid[0].m_ColHeaderCell.GetValue(new SourceGrid2.Position(1, r)), typeof(string)); grid2[r, 3] = new SourceGrid2.Cells.Real.Cell(CComLibrary.GlobeVal.outgrid[0].m_DataCell.GetValue(new SourceGrid2.Position(1, r)), typeof(string)); grid2[r, 4] = new SourceGrid2.Cells.Real.Cell(CComLibrary.GlobeVal.outgrid[0].m_DataCell.GetValue(new SourceGrid2.Position(4, r)), typeof(string)); grid2[r, 5] = new SourceGrid2.Cells.Real.Cell(r.ToString(), typeof(string)); } for (i = 0; i < grid2.ColumnsCount; i++) { grid2.Columns[i].Width = (grid2.Width - 30) / grid2.ColumnsCount; } //grid2.AutoSizeAll(); timer1.Enabled = true; }
private void Form4_Load(object sender, EventArgs e) { int i; grid1.BorderStyle = BorderStyle.FixedSingle; grid1.ColumnsCount = 5; //grid1.FixedRows = 1; grid1.Rows.Insert(0); grid1[0, 0] = new SourceGrid2.Cells.Real.ColumnHeader("名称"); grid1[0, 1] = new SourceGrid2.Cells.Real.ColumnHeader("行"); grid1[0, 2] = new SourceGrid2.Cells.Real.ColumnHeader("列"); grid1[0, 3] = new SourceGrid2.Cells.Real.ColumnHeader("文件名称"); grid1[0, 4] = new SourceGrid2.Cells.Real.ColumnHeader("文件日期"); for (int r = 1; r < 2; r++) { grid1.Rows.Insert(r); grid1[r, 0] = new SourceGrid2.Cells.Real.Cell("数据1", typeof(string)); grid1[r, 1] = new SourceGrid2.Cells.Real.Cell(CComLibrary.GlobeVal.outgrid[0].Rows.Count.ToString(), typeof(string)); grid1[r, 2] = new SourceGrid2.Cells.Real.Cell(CComLibrary.GlobeVal.outgrid[0].Columns.Count.ToString(), typeof(string)); grid1[r, 3] = new SourceGrid2.Cells.Real.Cell(CComLibrary.GlobeVal.outgrid[0].Tag, typeof(string)); grid1[r, 4] = new SourceGrid2.Cells.Real.Cell(" ", typeof(string)); } for (i = 0; i < grid1.ColumnsCount; i++) { grid1.Columns[i].Width = (grid1.Width - 30) / grid1.ColumnsCount; } //grid1.AutoSizeAll(); grid2.BorderStyle = BorderStyle.FixedSingle; grid2.ColumnsCount = 7; //grid1.FixedRows = 1; grid2.Rows.Insert(0); grid2[0, 0] = new SourceGrid2.Cells.Real.ColumnHeader("X"); grid2[0, 1] = new SourceGrid2.Cells.Real.ColumnHeader("Y"); grid2[0, 2] = new SourceGrid2.Cells.Real.ColumnHeader("列"); grid2[0, 3] = new SourceGrid2.Cells.Real.ColumnHeader("名称"); grid2[0, 4] = new SourceGrid2.Cells.Real.ColumnHeader("第一个数据"); grid2[0, 5] = new SourceGrid2.Cells.Real.ColumnHeader("位置"); grid2[0, 6] = new SourceGrid2.Cells.Real.ColumnHeader("坐标轴位置"); string[] l_CmbArr = new string[] { "左侧", "右侧" }; for (int r = 1; r < CComLibrary.GlobeVal.filesave.m_namelist.Count; r++) { grid2.Rows.Insert(r); CComLibrary.GlobeVal.g_datatitle[r - 1] = CComLibrary.GlobeVal.filesave.m_namelist[r]; grid2[r, 0] = new SourceGrid2.Cells.Real.CheckBox(false); grid2[r, 1] = new SourceGrid2.Cells.Real.CheckBox(false); grid2[r, 2] = new SourceGrid2.Cells.Real.Cell(r.ToString(), typeof(string)); grid2[r, 3] = new SourceGrid2.Cells.Real.Cell(CComLibrary.GlobeVal.filesave.m_namelist[r], typeof(string)); grid2[r, 4] = new SourceGrid2.Cells.Real.Cell("0", typeof(string)); grid2[r, 5] = new SourceGrid2.Cells.Real.Cell(r.ToString(), typeof(string)); grid2[r, 6] = new SourceGrid2.Cells.Real.ComboBox(l_CmbArr[0], typeof(string), l_CmbArr, true); } for (i = 0; i < grid2.ColumnsCount; i++) { grid2.Columns[i].Width = (grid2.Width - 30) / grid2.ColumnsCount; } //grid2.AutoSizeAll(); timer1.Enabled = true; }
private void Form4_Load(object sender, EventArgs e) { int i; grid1.BorderStyle = BorderStyle.FixedSingle; grid1.ColumnsCount = 5; grid1.FixedRows = 1; grid1.Rows.Insert(0); grid1[0, 0] = new SourceGrid2.Cells.Real.ColumnHeader("名称"); grid1[0, 1] = new SourceGrid2.Cells.Real.ColumnHeader("行"); grid1[0, 2] = new SourceGrid2.Cells.Real.ColumnHeader("列"); grid1[0, 3] = new SourceGrid2.Cells.Real.ColumnHeader("文件名称"); grid1[0, 4] = new SourceGrid2.Cells.Real.ColumnHeader("文件日期"); for (int r = 1; r < 2; r++) { grid1.Rows.Insert(r); grid1[r, 0] = new SourceGrid2.Cells.Real.Cell("数据1", typeof(string)); grid1[r, 1] = new SourceGrid2.Cells.Real.Cell(CComLibrary.GlobeVal.outgrid[0].Rows.Count.ToString(), typeof(string)); grid1[r, 2] = new SourceGrid2.Cells.Real.Cell(CComLibrary.GlobeVal.outgrid[0].Columns.Count.ToString(), typeof(string)); grid1[r, 3] = new SourceGrid2.Cells.Real.Cell(CComLibrary.GlobeVal.outgrid[0].Tag, typeof(string)); grid1[r, 4] = new SourceGrid2.Cells.Real.Cell(" ", typeof(string)); } for (i = 0; i < grid1.ColumnsCount; i++) { grid1.Columns[i].Width = (grid1.Width - 30) / grid1.ColumnsCount; } //grid1.AutoSizeAll(); grid2.BorderStyle = BorderStyle.FixedSingle; grid2.ColumnsCount = 7; grid2.FixedRows = 1; grid2.Rows.Insert(0); grid2[0, 0] = new SourceGrid2.Cells.Real.ColumnHeader("X"); grid2[0, 1] = new SourceGrid2.Cells.Real.ColumnHeader("Y"); grid2[0, 2] = new SourceGrid2.Cells.Real.ColumnHeader("列"); grid2[0, 3] = new SourceGrid2.Cells.Real.ColumnHeader("名称"); grid2[0, 4] = new SourceGrid2.Cells.Real.ColumnHeader("第一个数据"); grid2[0, 5] = new SourceGrid2.Cells.Real.ColumnHeader("位置"); grid2[0, 6] = new SourceGrid2.Cells.Real.ColumnHeader("坐标轴位置"); string[] l_CmbArr = new string[] { "左侧", "右侧" }; for (int r = 1; r < CComLibrary.GlobeVal.outgrid[0].ColumnsCount; r++) { grid2.Rows.Insert(r); grid2[r, 0] = new SourceGrid2.Cells.Real.CheckBox(false); grid2[r, 1] = new SourceGrid2.Cells.Real.CheckBox(false); grid2[r, 2] = new SourceGrid2.Cells.Real.Cell(CComLibrary.GlobeVal.outgrid[0].m_ColHeaderCell.GetValue(new SourceGrid2.Position(1, r)), typeof(string)); grid2[r, 3] = new SourceGrid2.Cells.Real.Cell(CComLibrary.GlobeVal.outgrid[0].m_DataCell.GetValue(new SourceGrid2.Position(1, r)), typeof(string)); grid2[r, 4] = new SourceGrid2.Cells.Real.Cell(CComLibrary.GlobeVal.outgrid[0].m_DataCell.GetValue(new SourceGrid2.Position(4, r)), typeof(string)); grid2[r, 5] = new SourceGrid2.Cells.Real.Cell(r.ToString(), typeof(string)); grid2[r, 6] = new SourceGrid2.Cells.Real.ComboBox(l_CmbArr[0], typeof(string), l_CmbArr, true); } for (i = 0; i < grid2.ColumnsCount; i++) { grid2.Columns[i].Width = (grid2.Width - 30) / grid2.ColumnsCount; } //grid2.AutoSizeAll(); for (i = 1; i < grid2.RowsCount; i++) { if (CComLibrary.GlobeVal.xsel == i) { grid2.SetCell(new SourceGrid2.Position(i, 0), new SourceGrid2.Cells.Real.CheckBox(true)); } for (int j = 0; j < CComLibrary.GlobeVal.yselcount; j++) { if (CComLibrary.GlobeVal.ysels[j] == i) { grid2.SetCell(new SourceGrid2.Position(i, 1), new SourceGrid2.Cells.Real.CheckBox(true)); grid2.SetCell(new SourceGrid2.Position(i, 6), new SourceGrid2.Cells.Real.ComboBox(l_CmbArr[CComLibrary.GlobeVal.yselpostion[j]], typeof(string), l_CmbArr, true)); } } } timer1.Enabled = true; }
public void ResetPar() { bool fitpok = true; lock(this) { GraphModel model = graph.Model; string name; int i; name = (string)function.Text; f = null; for (i = 0; i < model.Items.Count; i++) { if ((model.Items[i].name == name) && (model.Items[i] is Function1D) && (((Function1D)model.Items[i]).Fitable())) { f = (Function1D)model.Items[i]; } } name = (string)data.Text; dataItem = null; for (i = 0; i < model.Items.Count; i++) { if ((model.Items[i].name == name) && (model.Items[i] is DataItem)) { dataItem = (DataItem)model.Items[i]; } } if (f != null) { if (f != oldf || f.Modified) { if (f != oldf) { fitp = new bool[f.p.Length]; for (i = 0; i < f.p.Length; i++) { fitp[i] = true; } } 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 (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 SourceGrid2.Cells.Real.Cell(f.p[i], typeof(double)); if (covar == null) { grid[i+1, 3] = new SourceGrid2.Cells.Real.Cell("", typeof(string)); } else { grid[i+1, 3] = new SourceGrid2.Cells.Real.Cell(Math.Sqrt(covar[i, i]), typeof(double)); } grid[i+1, 3].DataModel.EnableEdit = false; } covar = null; } plength = f.p.Length; } if (f == null) { grid.RowsCount = 4; grid.ColumnsCount = 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]"); } grid.AutoSize(); oldf = f; Q.Text = ""; chisq.Text = ""; covariance.Enabled = covar != null; fitpok = false; for (i = 0; i < fitp.Length; i++) { if (fitp[i]) fitpok = true; } start.Enabled = (f != null && data != null && fitpok); neval.Text = ""; } }
private void LoadProjectInfo() { try { hshProjects = syncMgr.GetProjects(false); gridProjects.FixedRows = 1; gridProjects.AutoStretchColumnsToFitWidth = true; // create a visual model for right-aligned text with trimming SourceGrid2.VisualModels.Common vmEllipsePath = new SourceGrid2.VisualModels.Common(); vmEllipsePath.StringFormat.Trimming = StringTrimming.EllipsisPath; // create a visual model for flat headers SourceGrid2.VisualModels.Common vmHeader = new SourceGrid2.VisualModels.FlatHeader(); vmHeader.BackColor = Color.FromArgb(228, 229, 237); SourceGrid2.BehaviorModels.Header bmHeader = new SourceGrid2.BehaviorModels.Header(); // set up the header row gridProjects.Rows.Insert(0); // set up the columns gridProjects.Columns.Insert(0); // hidden sync project full path gridProjects[0, 0] = new SourceGrid2.Cells.Real.ColumnHeader("", vmHeader, bmHeader); gridProjects.Columns.Insert(1); // check box column gridProjects[0, 1] = new SourceGrid2.Cells.Real.ColumnHeader("Sync?", vmHeader, bmHeader); gridProjects.Columns.Insert(2); // project name gridProjects[0, 2] = new SourceGrid2.Cells.Real.ColumnHeader("Project Name", vmHeader, bmHeader); gridProjects.Columns.Insert(3); // sync folder short for display gridProjects[0, 3] = new SourceGrid2.Cells.Real.ColumnHeader("Outlook Sync Folder", vmHeader, bmHeader); gridProjects.Columns.Insert(4); // browse button gridProjects[0, 4] = new SourceGrid2.Cells.Real.ColumnHeader("", vmHeader, bmHeader); SizeColumns(); if (hshProjects == null) { return; } // add rows for projects int iRow = 0; foreach (ProjectInfo projInfo in hshProjects.Values) { iRow++; gridProjects.Rows.Insert(iRow); // add row if (!hshProjRows.Contains(projInfo.ProjID)) { hshProjRows.Add(projInfo.ProjID, iRow); } // add each cell individually // sync folder path gridProjects[iRow, col_SyncFolderFull] = new SourceGrid2.Cells.Real.Cell(projInfo.SyncFolder); // checkbox for sync enabled gridProjects[iRow, col_SyncEnabled] = new SourceGrid2.Cells.Real.CheckBox(projInfo.SyncEnabled); // project name gridProjects[iRow, col_ProjName] = new SourceGrid2.Cells.Real.Cell(projInfo.ProjectName); // sync folder short gridProjects[iRow, col_SyncFolder] = new SourceGrid2.Cells.Real.Cell(projInfo.SyncFolderShort); gridProjects[iRow, col_SyncFolder].VisualModel = vmEllipsePath; // browse button gridProjects[iRow, col_BrowseButton] = new SourceGrid2.Cells.Real.Button("...", new SourceGrid2.PositionEventHandler(BrowseOutlookFolders_Click)); FlatHeader vm = new FlatHeader(); vm.BackColor = Color.FromArgb(228, 229, 237); gridProjects[iRow, col_BrowseButton].VisualModel = vm; // TODO: NEXT VERSION ... add a hidden row for additional project settings that displays when // the main project row is selected } } catch (System.Exception ex) { ErrorHandler.PublishError(ex, syncMgr.Logger); } }
public void ResetPar() { bool fitpok = true; lock (this) { GraphModel model = graph.Model; string name; int i; name = (string)function.Text; f = null; for (i = 0; i < model.Items.Count; i++) { if ((model.Items[i].name == name) && (model.Items[i] is Function1D) && (((Function1D)model.Items[i]).Fitable())) { f = (Function1D)model.Items[i]; } } name = (string)data.Text; dataItem = null; for (i = 0; i < model.Items.Count; i++) { if ((model.Items[i].name == name) && (model.Items[i] is DataItem)) { dataItem = (DataItem)model.Items[i]; } } if (f != null) { if (f != oldf || f.Modified) { if (f != oldf) { fitp = new bool[f.p.Length]; for (i = 0; i < f.p.Length; i++) { fitp[i] = true; } } 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 (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 SourceGrid2.Cells.Real.Cell(f.p[i], typeof(double)); if (covar == null) { grid[i + 1, 3] = new SourceGrid2.Cells.Real.Cell("", typeof(string)); } else { grid[i + 1, 3] = new SourceGrid2.Cells.Real.Cell(Math.Sqrt(covar[i, i]), typeof(double)); } grid[i + 1, 3].DataModel.EnableEdit = false; } covar = null; } plength = f.p.Length; } if (f == null) { grid.RowsCount = 4; grid.ColumnsCount = 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]"); } grid.AutoSize(); oldf = f; Q.Text = ""; chisq.Text = ""; covariance.Enabled = covar != null; fitpok = false; for (i = 0; i < fitp.Length; i++) { if (fitp[i]) { fitpok = true; } } start.Enabled = (f != null && data != null && fitpok); neval.Text = ""; } }