public void Reset(float[,] covar) { int x, y, n = covar.GetLength(0), m = covar.GetLength(1); grid.RowsCount = m + 1; grid.ColumnsCount = n + 1; grid[0, 0] = new SourceGrid2.Cells.Real.Header(); for (x = 0; x < n; x++) { grid[0, x + 1] = new SourceGrid2.Cells.Real.ColumnHeader(x + 1); } for (y = 0; y < m; y++) { grid[y + 1, 0] = new SourceGrid2.Cells.Real.RowHeader(y + 1); } for (x = 0; x < n; x++) { for (y = 0; y < m; y++) { grid[x + 1, y + 1] = new SourceGrid2.Cells.Real.Cell(covar[x, y], typeof(double)); grid[x + 1, y + 1].DataModel.EnableEdit = false; } } grid.AutoSize(); }
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; 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 SourceGrid2.Cells.Real.Cell(item.p[r], typeof(double)); } grid.Columns[0].AutoSizeMode = SourceGrid2.AutoSizeMode.MinimumSize; grid.Columns[1].AutoSizeMode = SourceGrid2.AutoSizeMode.MinimumSize; 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 = ""; } }
public UserControl系统设置() { InitializeComponent(); tabControl1.ItemSize = new Size(1, 1); ms = new string[2]; ms[0] = "使用"; ms[1] = "不使用"; grid1.RowsCount = 0; grid1.AutoStretchColumnsToFitWidth = true; grid1.BorderStyle = BorderStyle.FixedSingle; grid1.ColumnsCount = 7; grid1.Columns[0].Width = grid1.Width / 7; grid1.Columns[1].Width = grid1.Width / 7; grid1.Columns[2].Width = grid1.Width / 7; grid1.Columns[3].Width = grid1.Width / 7; grid1.Columns[4].Width = grid1.Width / 7; grid1.Columns[5].Width = grid1.Width / 7; grid1.Columns[6].Width = grid1.Width / 7; grid1.Columns[6].AutoSizeMode = SourceGrid2.AutoSizeMode.EnableStretch; grid1.FixedRows = 1; grid1.RowsCount = 0; grid1.Rows.Insert(0); SourceGrid2.Cells.Real.ColumnHeader head = new SourceGrid2.Cells.Real.ColumnHeader("[硬件通道名称]"); head.EnableSort = false; head.EnableEdit = false; grid1[0, 0] = head; head = new SourceGrid2.Cells.Real.ColumnHeader("[硬件通道量纲]"); head.EnableSort = false; head.EnableEdit = false; grid1[0, 1] = head; head = new SourceGrid2.Cells.Real.ColumnHeader("[硬件通道单位]"); head.EnableSort = false; head.EnableEdit = false; grid1[0, 2] = head; head = new SourceGrid2.Cells.Real.ColumnHeader("[硬件通道内部名称]"); head.EnableSort = false; head.EnableEdit = false; grid1[0, 3] = head; head = new SourceGrid2.Cells.Real.ColumnHeader("硬件通道量程"); head.EnableSort = false; grid1[0, 4] = head; head = new SourceGrid2.Cells.Real.ColumnHeader("硬件通道闭环控制"); head.EnableSort = false; grid1[0, 5] = head; head = new SourceGrid2.Cells.Real.ColumnHeader("硬件通道采集方式"); head.EnableSort = false; grid1[0, 6] = head; //判断如果没有控制通道,则设置一个控制通道,防止系统出错 bool mb = false; for (int i = 1; i <= ClsStaticStation.m_Global.mycls.chsignals.Count; i++) { if (GlobeVal.mysys.ChannelControl[i - 1] == true) { mb = true; } } if (mb == false) { GlobeVal.mysys.ChannelControl[0] = true; } for (int i = 1; i <= ClsStaticStation.m_Global.mycls.chsignals.Count; i++) { grid1.Rows.Insert(i); grid1[i, 0] = new SourceGrid2.Cells.Real.Cell( ClsStaticStation.m_Global.mycls.chsignals[i - 1].cName, typeof(string)); grid1[i, 1] = new SourceGrid2.Cells.Real.ComboBox( ClsStaticStation.m_Global.mycls.SignalsNames[ClsStaticStation.m_Global.mycls.chsignals[i - 1].cUnitKind], typeof(string), ClsStaticStation.m_Global.mycls.SignalsNames, false); grid1[i, 2] = new SourceGrid2.Cells.Real.ComboBox( ClsStaticStation.m_Global.mycls.chsignals[i - 1].cUnits[ ClsStaticStation.m_Global.mycls.chsignals[i - 1].cUnitsel], typeof(string), ClsStaticStation.m_Global.mycls.chsignals[i - 1].cUnits, false); grid1[i, 3] = new SourceGrid2.Cells.Real.Cell( ClsStaticStation.m_Global.mycls.chsignals[i - 1].SignName, typeof(string)); grid1[i, 4] = new SourceGrid2.Cells.Real.Cell( GlobeVal.mysys.ChannelRange[i - 1], typeof(double)); grid1[i, 5] = new SourceGrid2.Cells.Real.Cell( GlobeVal.mysys.ChannelControl[i - 1], typeof(bool)); grid1[i, 6] = new SourceGrid2.Cells.Real.ComboBox( ms[GlobeVal.mysys.ChannelSamplemode[i - 1]], typeof(string), ms, false); } }
public void Init(int sel) { int i = 0; tabControl1.SelectedIndex = sel; grid1.RowsCount = 0; grid1.AutoStretchColumnsToFitWidth = true; grid1.BorderStyle = BorderStyle.FixedSingle; grid1.ColumnsCount = 2; grid1.Columns[0].Width = grid1.Width / 2; grid1.Columns[1].Width = grid1.Width - grid1.Columns[0].Width - 1; grid1.Columns[1].AutoSizeMode = SourceGrid2.AutoSizeMode.EnableStretch; grid1.FixedRows = 1; grid1.Rows.Insert(0); if (GlobeVal.mysys.language == 0) { grid1[0, 0] = new SourceGrid2.Cells.Real.ColumnHeader("系统属性"); grid1[0, 1] = new SourceGrid2.Cells.Real.ColumnHeader("值"); } else { grid1[0, 0] = new SourceGrid2.Cells.Real.ColumnHeader("System property"); grid1[0, 1] = new SourceGrid2.Cells.Real.ColumnHeader("Value"); } i = 1; grid1.Rows.Insert(i); if (GlobeVal.mysys.language == 0) { grid1[i, 0] = new SourceGrid2.Cells.Real.Cell( "软件设置", typeof(string)); } else { grid1[i, 0] = new SourceGrid2.Cells.Real.Cell( "Software configuration", typeof(string)); } #if Demo if (GlobeVal.mysys.language == 0) { grid1[i, 1] = new SourceGrid2.Cells.Real.Cell( "演示版", typeof(string)); labelVersion1.Text = "版本 演示版"; } else { grid1[i, 1] = new SourceGrid2.Cells.Real.Cell( "Demo", typeof(string)); labelVersion1.Text = "Version: demo "; } #else if (GlobeVal.mysys.language == 0) { grid1[i, 1] = new SourceGrid2.Cells.Real.Cell( "完整版", typeof(string)); labelVersion1.Text = "版本 完整版"; } else { grid1[i, 1] = new SourceGrid2.Cells.Real.Cell( "Full", typeof(string)); labelVersion1.Text = "Version full"; } #endif i = 2; grid1.Rows.Insert(i); if (GlobeVal.mysys.language == 0) { grid1[i, 0] = new SourceGrid2.Cells.Real.Cell( "软件到期日期", typeof(string)); } else { grid1[i, 0] = new SourceGrid2.Cells.Real.Cell( "Software expiration date", typeof(string)); } grid1[i, 1] = new SourceGrid2.Cells.Real.Cell( "3000.1.1", typeof(string)); i = 3; grid1.Rows.Insert(i); if (GlobeVal.mysys.language == 0) { grid1[i, 0] = new SourceGrid2.Cells.Real.Cell( "软件编译日期", typeof(string)); } else { grid1[i, 0] = new SourceGrid2.Cells.Real.Cell( "Date of software compilation", typeof(string)); } string ss = ""; DateTime dt; var version = Assembly.GetExecutingAssembly().GetName().Version; dt = System.IO.File.GetLastWriteTime(this.GetType().Assembly.Location); // AddDays(Assembly.GetExecutingAssembly().GetName().Version.Build).AddSeconds(Assembly.GetExecutingAssembly().GetName().Version.Revision * 2f); ss = Assembly.GetExecutingAssembly().GetName().Version.Major.ToString() + "." + Assembly.GetExecutingAssembly().GetName().Version.Minor.ToString() + "(Build " + dt.ToString("yyyy-MM-dd HH:mm:ss") + ")"; grid1[i, 1] = new SourceGrid2.Cells.Real.Cell( ss, typeof(string)); i = 4; grid1.Rows.Insert(i); if (GlobeVal.mysys.language == 0) { grid1[i, 0] = new SourceGrid2.Cells.Real.Cell( "软件版本", typeof(string)); } else { grid1[i, 0] = new SourceGrid2.Cells.Real.Cell( "Software version", typeof(string)); } grid1[i, 1] = new SourceGrid2.Cells.Real.Cell( System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(), typeof(string)); /* i = 5; * grid1.Rows.Insert(i); * grid1[i, 0] = new SourceGrid2.Cells.Real.Cell( * "秘钥", typeof(string)); * * grid1[i, 1] = new SourceGrid2.Cells.Real.Cell( * GlobeVal.mysys.KeyCode, typeof(string)); * * i = 6; * grid1.Rows.Insert(i); * grid1[i, 0] = new SourceGrid2.Cells.Real.Cell( * "主机型号", typeof(string)); * * grid1[i, 1] = new SourceGrid2.Cells.Real.Cell( * GlobeVal.mysys.framemodel.ToString(), typeof(string)); * * * i = 7; * grid1.Rows.Insert(i); * grid1[i, 0] = new SourceGrid2.Cells.Real.Cell( * "主机序列号", typeof(string)); * * grid1[i, 1] = new SourceGrid2.Cells.Real.Cell( * GlobeVal.mysys.frameserialnumber.ToString(), typeof(string)); * * * i = 8; * grid1.Rows.Insert(i); * grid1[i, 0] = new SourceGrid2.Cells.Real.Cell( * "网卡地址", typeof(string)); * * grid1[i, 1] = new SourceGrid2.Cells.Real.Cell( * GlobeVal.mysys.macaddress.ToString(), typeof(string));*/ }
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 initgrid() { ms = new string[20]; if (GlobeVal.mysys.language == 0) { ms[0] = "内部"; for (int i = 1; i <= 16; i++) { ms[i] = "外部通道" + (i).ToString().Trim(); } ms1 = new string[2]; ms1[0] = "通道1"; ms1[1] = "通道2"; } else { ms[0] = "Inside"; for (int i = 1; i <= 16; i++) { ms[i] = "External channel" + (i).ToString().Trim(); } ms1 = new string[2]; ms1[0] = "Station 1"; ms1[1] = "Station 2"; } grid1.RowsCount = 0; grid1.AutoStretchColumnsToFitWidth = true; grid1.BorderStyle = BorderStyle.FixedSingle; grid1.ColumnsCount = 8; grid1.Columns[0].Width = grid1.Width / 8; grid1.Columns[1].Width = grid1.Width / 8; grid1.Columns[2].Width = grid1.Width / 8; grid1.Columns[3].Width = grid1.Width / 8; grid1.Columns[4].Width = grid1.Width / 8; grid1.Columns[5].Width = grid1.Width / 8; grid1.Columns[6].Width = grid1.Width / 8; grid1.Columns[7].Width = grid1.Width - grid1.Columns[0].Width - 1; grid1.Columns[7].AutoSizeMode = SourceGrid2.AutoSizeMode.EnableStretch; grid1.FixedRows = 1; grid1.Rows.Insert(0); string _temp = ""; if (GlobeVal.mysys.language == 0) { _temp = "[硬件通道名称]"; } else { _temp = "[hardware channel name]"; } SourceGrid2.Cells.Real.ColumnHeader head = new SourceGrid2.Cells.Real.ColumnHeader(_temp); head.EnableSort = false; grid1[0, 0] = head; if (GlobeVal.mysys.language == 0) { _temp = "[硬件通道量纲]"; } else { _temp = "[hardware channel dimension]"; } head = new SourceGrid2.Cells.Real.ColumnHeader(_temp); head.EnableSort = false; grid1[0, 1] = head; if (GlobeVal.mysys.language == 0) { _temp = "[硬件通道单位]"; } else { _temp = "[Hardware channel unit]"; } head = new SourceGrid2.Cells.Real.ColumnHeader(_temp); head.EnableSort = false; head.EnableEdit = false; grid1[0, 2] = head; if (GlobeVal.mysys.language == 0) { _temp = "[硬件通道内部名称]"; } else { _temp = "[Hardware channel internal name]"; } head = new SourceGrid2.Cells.Real.ColumnHeader(_temp); head.EnableSort = false; head.EnableEdit = false; grid1[0, 3] = head; if (GlobeVal.mysys.language == 0) { _temp = "[硬件通道量程]"; } else { _temp = "[Hardware channel range]"; } head = new SourceGrid2.Cells.Real.ColumnHeader(_temp); head.EnableSort = false; grid1[0, 4] = head; if (GlobeVal.mysys.language == 0) { _temp = "[硬件通道闭环控制]"; } else { _temp = "[Hardware channel closed loop control]"; } head = new SourceGrid2.Cells.Real.ColumnHeader(_temp); head.EnableSort = false; grid1[0, 5] = head; if (GlobeVal.mysys.language == 0) { _temp = "[硬件通道采集方式]"; } else { _temp = "[Hardware channel acquisition mode]"; } head = new SourceGrid2.Cells.Real.ColumnHeader(_temp); head.EnableSort = false; grid1[0, 6] = head; if (GlobeVal.mysys.language == 0) { _temp = "[硬件控制通道]"; } else { _temp = "[Hardware control channel]"; } head = new SourceGrid2.Cells.Real.ColumnHeader(_temp); head.EnableSort = false; grid1[0, 7] = head; //判断如果没有控制通道,则设置一个控制通道,防止系统出错 bool mb = false; for (int i = 1; i <= ClsStaticStation.m_Global.mycls.chsignals.Count; i++) { if (GlobeVal.mysys.ChannelControl[i - 1] == true) { mb = true; } } if (mb == false) { GlobeVal.mysys.ChannelControl[0] = true; } for (int i = 1; i <= ClsStaticStation.m_Global.mycls.chsignals.Count; i++) { grid1.Rows.Insert(i); grid1[i, 0] = new SourceGrid2.Cells.Real.Cell( GlobeVal.mysys.ChannelName[i - 1], typeof(string)); grid1[i, 1] = new SourceGrid2.Cells.Real.ComboBox( // ClsStaticStation.m_Global.mycls.SignalsNames[ClsStaticStation.m_Global.mycls.chsignals[i - 1].cUnitKind], typeof(string), // ClsStaticStation.m_Global.mycls.SignalsNames, false); ClsStaticStation.m_Global.mycls.SignalsNames[GlobeVal.mysys.ChannelDimension[i - 1]], typeof(string), ClsStaticStation.m_Global.mycls.SignalsNames, false); grid1[i, 2] = new SourceGrid2.Cells.Real.ComboBox( ClsStaticStation.m_Global.mycls.chsignals[i - 1].cUnits[ ClsStaticStation.m_Global.mycls.chsignals[i - 1].cUnitsel], typeof(string), ClsStaticStation.m_Global.mycls.chsignals[i - 1].cUnits, false); grid1[i, 3] = new SourceGrid2.Cells.Real.Cell( ClsStaticStation.m_Global.mycls.chsignals[i - 1].SignName, typeof(string)); grid1[i, 4] = new SourceGrid2.Cells.Real.Cell( GlobeVal.mysys.ChannelRange[i - 1], typeof(double)); grid1[i, 5] = new SourceGrid2.Cells.Real.Cell( GlobeVal.mysys.ChannelControl[i - 1], typeof(bool)); grid1[i, 6] = new SourceGrid2.Cells.Real.ComboBox( ms[GlobeVal.mysys.ChannelSamplemode[i - 1]], typeof(string), ms, false); grid1[i, 7] = new SourceGrid2.Cells.Real.ComboBox( ms1[GlobeVal.mysys.ChannelControlChannel[i - 1]], typeof(string), ms1, false); } }
public void Init格式() { toolStripCboElement.Items.Clear(); if (GlobeVal.mysys.language == 0) { toolStripCboElement.Items.Add("标题栏"); toolStripCboElement.Items.Add("固定列"); toolStripCboElement.Items.Add("内容"); } else { toolStripCboElement.Items.Add("Title bar"); toolStripCboElement.Items.Add("Fixed column"); toolStripCboElement.Items.Add("Content"); } toolStripCboElement.SelectedIndex = 0; if (resulttab == 0) { grid1.RowsCount = 0; grid1.BorderStyle = BorderStyle.Fixed3D; grid1.AutoStretchRowsToFitHeight = true; grid1.ColumnsCount = CComLibrary.GlobeVal.filesave.mtablecol1.Count + 2; grid1.FixedRows = 1; grid1.FixedColumns = 1; grid1.Rows.Insert(0); grid1.Rows[0].Height = 30; SourceGrid2.Cells.Real.ColumnHeader boldHeader = new SourceGrid2.Cells.Real.ColumnHeader(); boldHeader.Font = new Font(CComLibrary.GlobeVal.filesave.mtable1para.mTableHeaderPara.HeaderFont.FontFamily, CComLibrary.GlobeVal.filesave.mtable1para.mTableHeaderPara.HeaderFont.Size); boldHeader.EnableSort = false; boldHeader.WordWrap = true; boldHeader.Value = ""; boldHeader.TextAlignment = CComLibrary.GlobeVal.filesave.mtable1para.mTableHeaderPara.HeaderAlignment; boldHeader.BackColor = CComLibrary.GlobeVal.filesave.mtable1para.mTableHeaderPara.HeaderBackColor; boldHeader.ForeColor = CComLibrary.GlobeVal.filesave.mtable1para.mTableHeaderPara.HeaderForeColor; grid1[0, 0] = boldHeader; for (int i = 0; i < CComLibrary.GlobeVal.filesave.mtablecol1.Count; i++) { boldHeader = new SourceGrid2.Cells.Real.ColumnHeader(); boldHeader.Font = new Font(CComLibrary.GlobeVal.filesave.mtable1para.mTableHeaderPara.HeaderFont.FontFamily, CComLibrary.GlobeVal.filesave.mtable1para.mTableHeaderPara.HeaderFont.Size); boldHeader.EnableSort = false; boldHeader.WordWrap = true; if (CComLibrary.GlobeVal.filesave.mtablecol1[i].apply == false) { boldHeader.Value = CComLibrary.GlobeVal.filesave.mtablecol1[i].formulaname + "(" + CComLibrary.GlobeVal.filesave.mtablecol1[i].myitemsignal.cUnits[ CComLibrary.GlobeVal.filesave.mtablecol1[i].myitemsignal.cUnitsel] + ")"; } else { boldHeader.Value = CComLibrary.GlobeVal.filesave.mtablecol1[i].formulaexplain + "(" + CComLibrary.GlobeVal.filesave.mtablecol1[i].myitemsignal.cUnits[ CComLibrary.GlobeVal.filesave.mtablecol1[i].myitemsignal.cUnitsel] + ")"; } boldHeader.TextAlignment = CComLibrary.GlobeVal.filesave.mtable1para.mTableHeaderPara.HeaderAlignment; boldHeader.BackColor = CComLibrary.GlobeVal.filesave.mtable1para.mTableHeaderPara.HeaderBackColor; boldHeader.ForeColor = CComLibrary.GlobeVal.filesave.mtable1para.mTableHeaderPara.HeaderForeColor; grid1[0, 1 + i] = boldHeader; } boldHeader = new SourceGrid2.Cells.Real.ColumnHeader(); boldHeader.Font = new Font(CComLibrary.GlobeVal.filesave.mtable1para.mTableHeaderPara.HeaderFont.FontFamily, CComLibrary.GlobeVal.filesave.mtable1para.mTableHeaderPara.HeaderFont.Size); boldHeader.EnableSort = false; boldHeader.WordWrap = true; boldHeader.Value = ""; boldHeader.BackColor = CComLibrary.GlobeVal.filesave.mtable1para.mTableHeaderPara.HeaderBackColor; boldHeader.ForeColor = CComLibrary.GlobeVal.filesave.mtable1para.mTableHeaderPara.HeaderForeColor; grid1[0, CComLibrary.GlobeVal.filesave.mtablecol1.Count + 1] = boldHeader; int mw = grid1.Width / grid1.ColumnsCount; for (int i = 0; i < grid1.ColumnsCount; i++) { grid1.Columns[i].Width = mw - 1; } grid1.Columns[grid1.ColumnsCount - 1].AutoSizeMode = SourceGrid2.AutoSizeMode.EnableStretch; grid1.AutoStretchColumnsToFitWidth = true; for (int i = 1; i <= 4; i++) { grid1.Rows.Insert(i); grid1[i, 0] = new SourceGrid2.Cells.Real.Button( typeof(string)); (grid1[i, 0] as SourceGrid2.Cells.Real.Button).Value = i.ToString(); SourceGrid2.VisualModels.MultiImages view = new SourceGrid2.VisualModels.MultiImages(); view.BackColor = CComLibrary.GlobeVal.filesave.mtable1para.mTableColPara.ColBackColor; view.ForeColor = CComLibrary.GlobeVal.filesave.mtable1para.mTableColPara.ColForeColor; view.Font = new Font(CComLibrary.GlobeVal.filesave.mtable1para.mTableColPara.ColFont.FontFamily, CComLibrary.GlobeVal.filesave.mtable1para.mTableColPara.ColFont.Size); if ((i == 2) || (i == 3)) { if (CComLibrary.GlobeVal.filesave.mtable1para.showvalidspe == true) { view.Image = imageList1.Images[1]; } else { view.Image = imageList1.Images[0]; } } else { view.Image = imageList1.Images[0]; } view.TextAlignment = CComLibrary.GlobeVal.filesave.mtable1para.mTableColPara.ColAlignment; grid1[i, 0].VisualModel = view; for (int j = 0; j < CComLibrary.GlobeVal.filesave.mtablecol1.Count; j++) { float t = 0; string s = t.ToString("F" + CComLibrary.GlobeVal.filesave.mtablecol1[j].myitemsignal.precise.ToString().Trim()); if (CComLibrary.GlobeVal.filesave.mtablecol1[j].myitemsignal.cUnitKind == 19) { s = ""; } grid1[i, 1 + j] = new SourceGrid2.Cells.Real.Cell( s, typeof(string)); (grid1[i, 1 + j] as SourceGrid2.Cells.Real.Cell).TextAlignment = CComLibrary.GlobeVal.filesave.mtable1para.mTableGridPara.GridAlignment; (grid1[i, 1 + j] as SourceGrid2.Cells.Real.Cell).BackColor = CComLibrary.GlobeVal.filesave.mtable1para.mTableGridPara.GridBackColor; (grid1[i, 1 + j] as SourceGrid2.Cells.Real.Cell).ForeColor = CComLibrary.GlobeVal.filesave.mtable1para.mTableGridPara.GridForeColor; (grid1[i, 1 + j] as SourceGrid2.Cells.Real.Cell).Font = new Font(CComLibrary.GlobeVal.filesave.mtable1para.mTableGridPara.GridFont.FontFamily, CComLibrary.GlobeVal.filesave.mtable1para.mTableGridPara.GridFont.Size); } grid1[i, grid1.ColumnsCount - 1] = new SourceGrid2.Cells.Real.Cell( "", typeof(string)); } chkspe.Checked = CComLibrary.GlobeVal.filesave.mtable1para.showvalidspe; if (CComLibrary.GlobeVal.filesave.mtable1para.statisticssel == 0) { this.radioButton1.Checked = true; this.radioButton2.Checked = false; this.radioButton3.Checked = false; } if (CComLibrary.GlobeVal.filesave.mtable1para.statisticssel == 1) { this.radioButton1.Checked = false; this.radioButton2.Checked = true; this.radioButton3.Checked = false; } if (CComLibrary.GlobeVal.filesave.mtable1para.statisticssel == 2) { this.radioButton1.Checked = false; this.radioButton2.Checked = false; this.radioButton3.Checked = true; } } if (resulttab == 1) { grid1.RowsCount = 0; grid1.BorderStyle = BorderStyle.Fixed3D; grid1.AutoStretchRowsToFitHeight = true; grid1.ColumnsCount = CComLibrary.GlobeVal.filesave.mtablecol2.Count + 2; grid1.FixedRows = 1; grid1.FixedColumns = 1; grid1.Rows.Insert(0); grid1.Rows[0].Height = 30; SourceGrid2.Cells.Real.ColumnHeader boldHeader = new SourceGrid2.Cells.Real.ColumnHeader(); boldHeader.Font = new Font(CComLibrary.GlobeVal.filesave.mtable2para.mTableHeaderPara.HeaderFont.FontFamily, CComLibrary.GlobeVal.filesave.mtable2para.mTableHeaderPara.HeaderFont.Size); boldHeader.EnableSort = false; boldHeader.WordWrap = true; boldHeader.Value = ""; boldHeader.TextAlignment = CComLibrary.GlobeVal.filesave.mtable2para.mTableHeaderPara.HeaderAlignment; boldHeader.BackColor = CComLibrary.GlobeVal.filesave.mtable2para.mTableHeaderPara.HeaderBackColor; boldHeader.ForeColor = CComLibrary.GlobeVal.filesave.mtable2para.mTableHeaderPara.HeaderForeColor; grid1[0, 0] = boldHeader; for (int i = 0; i < CComLibrary.GlobeVal.filesave.mtablecol2.Count; i++) { boldHeader = new SourceGrid2.Cells.Real.ColumnHeader(); boldHeader.Font = new Font(CComLibrary.GlobeVal.filesave.mtable2para.mTableHeaderPara.HeaderFont.FontFamily, CComLibrary.GlobeVal.filesave.mtable2para.mTableHeaderPara.HeaderFont.Size); boldHeader.EnableSort = false; boldHeader.WordWrap = true; if (CComLibrary.GlobeVal.filesave.mtablecol2[i].apply == false) { boldHeader.Value = CComLibrary.GlobeVal.filesave.mtablecol2[i].formulaname + "(" + CComLibrary.GlobeVal.filesave.mtablecol2[i].myitemsignal.cUnits[ CComLibrary.GlobeVal.filesave.mtablecol2[i].myitemsignal.cUnitsel] + ")"; } else { boldHeader.Value = CComLibrary.GlobeVal.filesave.mtablecol2[i].formulaexplain + "(" + CComLibrary.GlobeVal.filesave.mtablecol2[i].myitemsignal.cUnits[ CComLibrary.GlobeVal.filesave.mtablecol2[i].myitemsignal.cUnitsel] + ")"; } boldHeader.TextAlignment = CComLibrary.GlobeVal.filesave.mtable2para.mTableHeaderPara.HeaderAlignment; boldHeader.BackColor = CComLibrary.GlobeVal.filesave.mtable2para.mTableHeaderPara.HeaderBackColor; boldHeader.ForeColor = CComLibrary.GlobeVal.filesave.mtable2para.mTableHeaderPara.HeaderForeColor; grid1[0, 1 + i] = boldHeader; } boldHeader = new SourceGrid2.Cells.Real.ColumnHeader(); boldHeader.Font = new Font(CComLibrary.GlobeVal.filesave.mtable2para.mTableHeaderPara.HeaderFont.FontFamily, CComLibrary.GlobeVal.filesave.mtable2para.mTableHeaderPara.HeaderFont.Size); boldHeader.EnableSort = false; boldHeader.WordWrap = true; boldHeader.Value = ""; boldHeader.BackColor = CComLibrary.GlobeVal.filesave.mtable2para.mTableHeaderPara.HeaderBackColor; boldHeader.ForeColor = CComLibrary.GlobeVal.filesave.mtable2para.mTableHeaderPara.HeaderForeColor; grid1[0, CComLibrary.GlobeVal.filesave.mtablecol2.Count + 1] = boldHeader; int mw = grid1.Width / grid1.ColumnsCount; for (int i = 0; i < grid1.ColumnsCount; i++) { grid1.Columns[i].Width = mw - 1; } grid1.Columns[grid1.ColumnsCount - 1].AutoSizeMode = SourceGrid2.AutoSizeMode.EnableStretch; grid1.AutoStretchColumnsToFitWidth = true; for (int i = 1; i <= 4; i++) { grid1.Rows.Insert(i); grid1[i, 0] = new SourceGrid2.Cells.Real.Button( typeof(string)); (grid1[i, 0] as SourceGrid2.Cells.Real.Button).Value = i.ToString(); SourceGrid2.VisualModels.MultiImages view = new SourceGrid2.VisualModels.MultiImages(); view.BackColor = CComLibrary.GlobeVal.filesave.mtable2para.mTableColPara.ColBackColor; view.ForeColor = CComLibrary.GlobeVal.filesave.mtable2para.mTableColPara.ColForeColor; view.Font = new Font(CComLibrary.GlobeVal.filesave.mtable2para.mTableColPara.ColFont.FontFamily, CComLibrary.GlobeVal.filesave.mtable2para.mTableColPara.ColFont.Size); if ((i == 2) || (i == 3)) { if (CComLibrary.GlobeVal.filesave.mtable1para.showvalidspe == true) { view.Image = imageList1.Images[1]; } else { view.Image = imageList1.Images[0]; } } else { view.Image = imageList1.Images[0]; } view.TextAlignment = CComLibrary.GlobeVal.filesave.mtable2para.mTableColPara.ColAlignment; grid1[i, 0].VisualModel = view; for (int j = 0; j < CComLibrary.GlobeVal.filesave.mtablecol2.Count; j++) { grid1[i, 1 + j] = new SourceGrid2.Cells.Real.Cell( "0.000", typeof(string)); (grid1[i, 1 + j] as SourceGrid2.Cells.Real.Cell).TextAlignment = CComLibrary.GlobeVal.filesave.mtable2para.mTableGridPara.GridAlignment; (grid1[i, 1 + j] as SourceGrid2.Cells.Real.Cell).BackColor = CComLibrary.GlobeVal.filesave.mtable2para.mTableGridPara.GridBackColor; (grid1[i, 1 + j] as SourceGrid2.Cells.Real.Cell).ForeColor = CComLibrary.GlobeVal.filesave.mtable2para.mTableGridPara.GridForeColor; (grid1[i, 1 + j] as SourceGrid2.Cells.Real.Cell).Font = new Font(CComLibrary.GlobeVal.filesave.mtable2para.mTableGridPara.GridFont.FontFamily, CComLibrary.GlobeVal.filesave.mtable2para.mTableGridPara.GridFont.Size); } grid1[i, grid1.ColumnsCount - 1] = new SourceGrid2.Cells.Real.Cell( "", typeof(string)); } chkspe.Checked = CComLibrary.GlobeVal.filesave.mtable2para.showvalidspe; if (CComLibrary.GlobeVal.filesave.mtable2para.statisticssel == 0) { this.radioButton1.Checked = true; this.radioButton2.Checked = false; this.radioButton3.Checked = false; } if (CComLibrary.GlobeVal.filesave.mtable2para.statisticssel == 1) { this.radioButton1.Checked = false; this.radioButton2.Checked = true; this.radioButton3.Checked = false; } if (CComLibrary.GlobeVal.filesave.mtable2para.statisticssel == 2) { this.radioButton1.Checked = false; this.radioButton2.Checked = false; this.radioButton3.Checked = true; } } }
public void Reset(FunctionItem item) { this.item = item; 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 SourceGrid2.Cells.Real.Cell(item.p[r], typeof(double)); } grid.Columns[0].AutoSizeMode = SourceGrid2.AutoSizeMode.MinimumSize; grid.Columns[1].AutoSizeMode = SourceGrid2.AutoSizeMode.MinimumSize; grid.AutoSize(); }
public void Reset(float[,] covar) { int x, y, n = covar.GetLength(0), m = covar.GetLength(1); grid.RowsCount = m+1; grid.ColumnsCount = n+1; grid[0, 0] = new SourceGrid2.Cells.Real.Header(); for (x = 0; x < n; x++) { grid[0, x+1] = new SourceGrid2.Cells.Real.ColumnHeader(x+1); } for (y = 0; y < m; y++) { grid[y+1, 0] = new SourceGrid2.Cells.Real.RowHeader(y+1); } for (x = 0; x < n; x++) { for (y = 0; y < m; y++) { grid[x+1, y+1] = new SourceGrid2.Cells.Real.Cell(covar[x, y], typeof(double)); grid[x+1, y+1].DataModel.EnableEdit = false; } } grid.AutoSize(); }
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 = ""; } }