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(); }
private void frmSample16_Load(object sender, System.EventArgs e) { grid1.Redim(10, 10); for (int r = 0; r < grid1.RowsCount; r++) { for (int c = 0; c < grid1.ColumnsCount; c++) { grid1[r, c] = new SourceGrid2.Cells.Real.Cell("Ciao", typeof(string)); } } }
private SourceGrid2.Cells.Real.Cell NewCell(object value, Color backColor, Color foreColor, ContentAlignment textAlignment, Font font, bool isEnableEdit, string toolTip) { SourceGrid2.VisualModels.Common visualModel = new SourceGrid2.VisualModels.Common(); visualModel.BackColor = backColor; visualModel.TextAlignment = textAlignment; visualModel.ForeColor = foreColor; visualModel.Font = font; visualModel.WordWrap = true; SourceGrid2.DataModels.EditorTextBox editorModel = new SourceGrid2.DataModels.EditorTextBox(typeof(string)); editorModel.EnableEdit = isEnableEdit; SourceGrid2.Cells.Real.Cell cell = new SourceGrid2.Cells.Real.Cell(value, editorModel, visualModel); cell.ToolTipText = toolTip; return(cell); }
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 dgLichKham_CellLostFocus(object sender, SourceGrid2.PositionCancelEventArgs e) { if (e.Position.Column < 3 || e.Position.Row < 2) { return; } SourceGrid2.Cells.Real.Cell cell = e.Cell as SourceGrid2.Cells.Real.Cell; object value = cell.Value; string strValue = value == null ? string.Empty : value.ToString().Trim(); if (_currentValue == strValue) { return; } LichKham lichKham = cell.Tag as LichKham; if (lichKham == null) { lichKham = new LichKham(); lichKham.Ngay = Convert.ToDateTime(dgLichKham[e.Position.Row, 0].Tag); lichKham.Type = (int)GetLoaiLichKham(e.Position.Column - 1); lichKham.Value = strValue; lichKham.CreatedDate = DateTime.Now; lichKham.CreatedBy = Guid.Parse(Global.UserGUID); } else { lichKham.Value = strValue; lichKham.UpdatedDate = DateTime.Now; lichKham.UpdatedBy = Guid.Parse(Global.UserGUID); } Result result = LichKhamBus.InsertLichKham(lichKham); if (result.IsOK) { cell.Tag = lichKham; } else { MsgBox.Show(Application.ProductName, result.GetErrorAsString("LichKhamBus.InsertLichKham"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("LichKhamBus.InsertLichKham")); } }
private void OnView() { SourceGrid2.Cells.Real.Cell cell = dgLichKham.FocusCell as SourceGrid2.Cells.Real.Cell; if (cell != null) { if (cell.Column < 3 || cell.Row < 2) { return; } object value = cell.Value; _currentValue = value == null ? string.Empty : value.ToString().Trim(); LichKham lichKham = cell.Tag as LichKham; if (lichKham == null) { lichKham = new LichKham(); lichKham.Ngay = Convert.ToDateTime(dgLichKham[cell.Row, 0].Tag); lichKham.Type = (int)GetLoaiLichKham(cell.Column - 1); lichKham.Value = _currentValue; lichKham.CreatedDate = DateTime.Now; lichKham.CreatedBy = Guid.Parse(Global.UserGUID); } else { lichKham.Value = _currentValue; lichKham.UpdatedDate = DateTime.Now; lichKham.UpdatedBy = Guid.Parse(Global.UserGUID); } Result result = LichKhamBus.InsertLichKham(lichKham); if (result.IsOK) { cell.Tag = lichKham; } else { MsgBox.Show(Application.ProductName, result.GetErrorAsString("LichKhamBus.InsertLichKham"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("LichKhamBus.InsertLichKham")); } } DisplayAsThread(); }
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 frmSample13_Load(object sender, System.EventArgs e) { //Create a VisualModel with an image m_VisualModel1 = new SourceGrid2.VisualModels.Common(); m_VisualModel1.Image = SampleImages.FACE01; m_VisualModel1.ImageAlignment = ContentAlignment.MiddleRight; //Create another VisualModel with an image m_VisualModel2 = new SourceGrid2.VisualModels.Common(); m_VisualModel2.Image = SampleImages.FACE02; m_VisualModel2.ImageAlignment = ContentAlignment.MiddleRight; cpVisualModelForeColor.SelectedColor = m_VisualModel1.ForeColor; //Now Create a DataModel m_DataModel = new SourceGrid2.DataModels.EditorTextBox(typeof(string)); //Create a behavior that change the VIsualModel of a cell when the user move the Mouse over the cell m_BehaviorModel = new SourceGrid2.BehaviorModels.CustomEvents(); m_BehaviorModel.MouseEnter += new SourceGrid2.PositionEventHandler(m_BehaviorModel_MouseEnter); m_BehaviorModel.MouseLeave += new SourceGrid2.PositionEventHandler(m_BehaviorModel_MouseLeave); //Populate the grid grid1.Redim(2, 2); for (int r = 0; r < grid1.RowsCount; r++) { for (int c = 0; c < grid1.ColumnsCount; c++) { SourceGrid2.Cells.Real.Cell l_Cell = new SourceGrid2.Cells.Real.Cell(); l_Cell.Value = r.ToString() + " " + c.ToString(); l_Cell.VisualModel = m_VisualModel1; l_Cell.DataModel = m_DataModel; l_Cell.Behaviors.Add(m_BehaviorModel); grid1[r, c] = l_Cell; } } //Now Set the width of the column grid1.Columns[0].Width = grid1.DisplayRectangle.Width / 2; grid1.Columns[1].Width = grid1.DisplayRectangle.Width / 2; }
private SourceGrid2.Cells.Real.Cell NewNumericCell(object value, Color backColor, Color foreColor, ContentAlignment textAlignment, Font font, bool isEnableEdit, string toolTip) { SourceGrid2.VisualModels.Common visualModel = new SourceGrid2.VisualModels.Common(); visualModel.BackColor = backColor; visualModel.TextAlignment = textAlignment; visualModel.ForeColor = foreColor; visualModel.Font = font; SourceGrid2.DataModels.EditorTextBoxNumeric editorModel = new SourceGrid2.DataModels.EditorTextBoxNumeric(typeof(int)); editorModel.EnableEdit = isEnableEdit; editorModel.MinimumValue = 0; editorModel.MaximumValue = 99999; editorModel.AllowNull = true; editorModel.DefaultValue = null; SourceGrid2.Cells.Real.Cell cell = new SourceGrid2.Cells.Real.Cell(value, editorModel, visualModel); cell.ToolTipText = toolTip; return(cell); }
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 TemplatesEditor_Load(object sender, System.EventArgs e) { SourceGrid2.DataModels.EditorTextBoxButton editorBtn = new SourceGrid2.DataModels.EditorTextBoxButton(typeof(string)); editorBtn.AttachEditorControl(gridList.ScrollablePanel); editorBtn.GetEditorTextBoxTypedButton(gridList.ScrollablePanel).DialogOpen += new EventHandler(TemplatesEditor_DialogOpen); gridList.ColumnsCount = 1; for (int r = 0; r < AvailableTemplateFiles.Count; r++) { gridList.Rows.Insert(r); gridList[r, 0] = new SourceGrid2.Cells.Real.Cell(AvailableTemplateFiles[r], editorBtn); } for (int r = AvailableTemplateFiles.Count; r < AvailableTemplateFiles.Count + 20; r++) { gridList.Rows.Insert(r); gridList[r, 0] = new SourceGrid2.Cells.Real.Cell("", editorBtn); } gridList.AutoSizeMinHeight = gridList.Font.Height; gridList.AutoStretchColumnsToFitWidth = true; gridList.StretchColumnsToFitWidth(); }
private void TemplatesEditor_Load(object sender, System.EventArgs e) { SourceGrid2.DataModels.EditorTextBoxButton editorBtn = new SourceGrid2.DataModels.EditorTextBoxButton(typeof(string)); editorBtn.AttachEditorControl(gridList.ScrollablePanel); editorBtn.GetEditorTextBoxTypedButton(gridList.ScrollablePanel).DialogOpen += new EventHandler(TemplatesEditor_DialogOpen); gridList.ColumnsCount = 1; for (int r = 0; r < AvailableTemplateFiles.Count; r++) { gridList.Rows.Insert(r); gridList[r, 0] = new SourceGrid2.Cells.Real.Cell(AvailableTemplateFiles[r], editorBtn); } for (int r = AvailableTemplateFiles.Count; r < AvailableTemplateFiles.Count+20; r++) { gridList.Rows.Insert(r); gridList[r, 0] = new SourceGrid2.Cells.Real.Cell("", editorBtn); } gridList.AutoSizeMinHeight = gridList.Font.Height; gridList.AutoStretchColumnsToFitWidth = true; gridList.StretchColumnsToFitWidth(); }
private void cbonum_SelectedIndexChanged(object sender, EventArgs e) { int a = cbonum.SelectedIndex + 1; string f = System.Windows.Forms.Application.StartupPath + "\\AppleLabJ\\device\\" + a.ToString().Trim() + "\\sys\\setup.ini"; if (System.IO.Directory.Exists(System.Windows.Forms.Application.StartupPath + "\\AppleLabJ\\device") == false) { System.IO.Directory.CreateDirectory(System.Windows.Forms.Application.StartupPath + "\\AppleLabJ\\device"); } if (System.IO.Directory.Exists(System.Windows.Forms.Application.StartupPath + "\\AppleLabJ\\device\\" + a.ToString().Trim()) == false) { System.IO.Directory.CreateDirectory(System.Windows.Forms.Application.StartupPath + "\\AppleLabJ\\device\\" + a.ToString().Trim()); } if (System.IO.Directory.Exists(System.Windows.Forms.Application.StartupPath + "\\AppleLabJ\\device\\" + a.ToString().Trim() + "\\sys") == false) { System.IO.Directory.CreateDirectory(System.Windows.Forms.Application.StartupPath + "\\AppleLabJ\\device\\" + a.ToString().Trim() + "\\sys"); } if (System.IO.File.Exists(f) == true) { } else { System.IO.File.Copy(System.Windows.Forms.Application.StartupPath + "\\AppleLabJ" + "\\sys\\setup.ini", f); } GlobeVal.mysys = GlobeVal.mysys.DeSerializeNow(f); grid1.RowsCount = 1; 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); } cboEdc.Items.Clear(); cboEdc.Items.Add("Edc"); cboEdc.Items.Add("IEdc"); cboEdc.SelectedIndex = GlobeVal.mysys.ChannelControllerType; }
private void FillData(List <LichKham> lichKhams) { DateTime dt = new DateTime(_nam, _thang, 1); int daysInMonth = DateTime.DaysInMonth(_nam, _thang); int rowIndex = 2; Color foreColor = Color.Black; Font fontBold = new Font("Tahoma", 9, FontStyle.Bold); Font fontNormal = new Font("Tahoma", 9); SourceGrid2.RectangleBorder borderRB = new SourceGrid2.RectangleBorder(new SourceGrid2.Border(Color.Black), new SourceGrid2.Border(Color.Black)); SourceGrid2.RectangleBorder borderRTB = new SourceGrid2.RectangleBorder(new SourceGrid2.Border(Color.Black), new SourceGrid2.Border(Color.Black)); borderRTB.Top = new SourceGrid2.Border(Color.Black); bool isBorderTop = true; for (int i = 0; i < daysInMonth; i++) { string dateStr = string.Format("{0} {1}", dt.ToString("dd/MM"), Utility.GetDayOfWeek(dt)); SourceGrid2.Cells.Real.Cell cell = NewCell(dateStr, Color.White, foreColor, ContentAlignment.MiddleCenter, fontBold, false, string.Empty); cell.Tag = dt; cell.Border = isBorderTop ? borderRTB : borderRB; dgLichKham[rowIndex, 0] = cell; Result result = BookingBus.GetBooking(dt); if (!result.IsOK) { MsgBox.Show(Application.ProductName, result.GetErrorAsString("BookingBus.GetBooking"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("BookingBus.GetBooking")); } for (int col = 0; col < 14; col++) { if (col < 2) { object value = null; if (result.QueryResult != null) { List <Booking> bookingList = result.QueryResult as List <Booking>; int count = GetPersonCount(bookingList, col); if (count > 0) { value = count; } } cell = NewNumericCell(value, Color.White, foreColor, ContentAlignment.MiddleCenter, fontNormal, false, string.Empty); } else { LichKham lichKham = GetLichKham(lichKhams, dt, GetLoaiLichKham(col)); bool isEnable = AllowEdit; object value = lichKham != null ? lichKham.Value : null; cell = NewCell(value, Color.White, foreColor, ContentAlignment.MiddleCenter, fontNormal, isEnable, string.Empty); cell.Tag = lichKham; } cell.Border = isBorderTop ? borderRTB : borderRB;; dgLichKham[rowIndex, col + 1] = cell; } isBorderTop = false; rowIndex++; if (dt.DayOfWeek == DayOfWeek.Sunday) { isBorderTop = true; if (i != 0 && i != daysInMonth - 1) { rowIndex++; } } dt = dt.AddDays(1); } }
private void InitHeader() { if (dgLichKham[0, 0] == null) { Font font = new System.Drawing.Font("Tohama", 9, FontStyle.Bold); SourceGrid2.Cells.Real.Cell cell = NewCell("Ngày", Color.Gray, Color.White, ContentAlignment.MiddleCenter, font, false, string.Empty); dgLichKham[0, 0] = cell; dgLichKham[0, 0].RowSpan = 2; cell = NewCell("Công ty", Color.Gray, Color.White, ContentAlignment.MiddleCenter, font, false, string.Empty); dgLichKham[0, 1] = cell; dgLichKham[0, 1].ColumnSpan = 2; cell = NewCell("Sáng", Color.Gray, Color.White, ContentAlignment.MiddleCenter, font, false, string.Empty); dgLichKham[1, 1] = cell; cell = NewCell("Chiều", Color.Gray, Color.White, ContentAlignment.MiddleCenter, font, false, string.Empty); dgLichKham[1, 2] = cell; cell = NewCell("Bs Nội tổng quát", Color.Gray, Color.White, ContentAlignment.MiddleCenter, font, false, string.Empty); dgLichKham[0, 3] = cell; dgLichKham[0, 3].ColumnSpan = 2; cell = NewCell("Sáng", Color.Gray, Color.White, ContentAlignment.MiddleCenter, font, false, string.Empty); dgLichKham[1, 3] = cell; cell = NewCell("Chiều", Color.Gray, Color.White, ContentAlignment.MiddleCenter, font, false, string.Empty); dgLichKham[1, 4] = cell; cell = NewCell("Bs Ngoại tổng quát", Color.Gray, Color.White, ContentAlignment.MiddleCenter, font, false, string.Empty); dgLichKham[0, 5] = cell; dgLichKham[0, 5].ColumnSpan = 2; cell = NewCell("Sáng", Color.Gray, Color.White, ContentAlignment.MiddleCenter, font, false, string.Empty); dgLichKham[1, 5] = cell; cell = NewCell("Chiều", Color.Gray, Color.White, ContentAlignment.MiddleCenter, font, false, string.Empty); dgLichKham[1, 6] = cell; cell = NewCell("Bs Tai Mũi Họng", Color.Gray, Color.White, ContentAlignment.MiddleCenter, font, false, string.Empty); dgLichKham[0, 7] = cell; dgLichKham[0, 7].ColumnSpan = 2; cell = NewCell("Sáng", Color.Gray, Color.White, ContentAlignment.MiddleCenter, font, false, string.Empty); dgLichKham[1, 7] = cell; cell = NewCell("Chiều", Color.Gray, Color.White, ContentAlignment.MiddleCenter, font, false, string.Empty); dgLichKham[1, 8] = cell; cell = NewCell("Bs Răng Hàm Mặt", Color.Gray, Color.White, ContentAlignment.MiddleCenter, font, false, string.Empty); dgLichKham[0, 9] = cell; dgLichKham[0, 9].ColumnSpan = 2; cell = NewCell("Sáng", Color.Gray, Color.White, ContentAlignment.MiddleCenter, font, false, string.Empty); dgLichKham[1, 9] = cell; cell = NewCell("Chiều", Color.Gray, Color.White, ContentAlignment.MiddleCenter, font, false, string.Empty); dgLichKham[1, 10] = cell; cell = NewCell("Bs Siêu Âm", Color.Gray, Color.White, ContentAlignment.MiddleCenter, font, false, string.Empty); dgLichKham[0, 11] = cell; dgLichKham[0, 11].ColumnSpan = 2; cell = NewCell("Sáng", Color.Gray, Color.White, ContentAlignment.MiddleCenter, font, false, string.Empty); dgLichKham[1, 11] = cell; cell = NewCell("Chiều", Color.Gray, Color.White, ContentAlignment.MiddleCenter, font, false, string.Empty); dgLichKham[1, 12] = cell; cell = NewCell("Bs Sản Phụ Khoa", Color.Gray, Color.White, ContentAlignment.MiddleCenter, font, false, string.Empty); dgLichKham[0, 13] = cell; dgLichKham[0, 13].ColumnSpan = 2; cell = NewCell("Sáng", Color.Gray, Color.White, ContentAlignment.MiddleCenter, font, false, string.Empty); dgLichKham[1, 13] = cell; cell = NewCell("Chiều", Color.Gray, Color.White, ContentAlignment.MiddleCenter, font, false, string.Empty); dgLichKham[1, 14] = cell; } }
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 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 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 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 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); } }
/// <summary> /// Fills the Grid with Binary Data /// </summary> /// <param name="data">The data to fill into the Grid</param> /// <remarks>The Grid will be cleard before the fill</remarks> protected void FillGrid(Byte[] data) { hexgrid.RowsCount = 0; hexgrid.Rows.Insert(0); hexgrid[0, 0] = new SourceGrid2.Cells.Real.Cell(""); hexgrid[0, 0].VisualModel = new SourceGrid2.VisualModels.FlatHeader(true); hexgrid[0, 0].Grid.BorderStyle = BorderStyle.None; for (int i = 1; i < hexgrid.ColumnsCount; i++) { hexgrid[0, i] = new SourceGrid2.Cells.Real.Header(MinLen((i - 1).ToString("X"), 2, '0')); hexgrid[0, i].VisualModel = new SourceGrid2.VisualModels.FlatHeader(true); hexgrid[0, i].Grid.BorderStyle = BorderStyle.None; } uint ct = 0; int row = 0; if (data != null) { while (ct < Math.Min(MaxSize, data.Length)) { int col = (int)(ct % (hexgrid.ColumnsCount - 1)); if (col == 0) { row++; hexgrid.Rows.Insert(row); hexgrid[row, 0] = new SourceGrid2.Cells.Real.Header("0x" + MinLen(ct.ToString("X").ToString(), 8, '0')); hexgrid[row, 0].VisualModel = new SourceGrid2.VisualModels.FlatHeader(true); hexgrid[row, 0].Grid.BorderStyle = BorderStyle.None; } if ((data[ct] == 0) && (hide_00)) { hexgrid[row, col + 1] = new SourceGrid2.Cells.Real.Cell(""); } else { hexgrid[row, col + 1] = new SourceGrid2.Cells.Real.Cell(MinLen(data[ct].ToString("X"), 2, '0')); } hexgrid[row, col + 1].Grid.BorderStyle = BorderStyle.None; ct++; } //while } hexgrid.AutoStretchColumnsToFitWidth = false; hexgrid.AutoSize(); hexgrid.Width = 0; for (int i = 0; i < hexgrid.ColumnsCount; i++) { hexgrid.Columns[i].Width -= 10; if (((i % 4) == 0) && (i != 0)) { hexgrid.Columns[i].Width += 10; } hexgrid.Width += hexgrid.Columns[i].Width; } hexgrid.Height = 0; for (int i = 0; i < hexgrid.RowsCount; i++) { hexgrid.Rows[i].Height = 15; hexgrid.Height += hexgrid.Rows[i].Height; } }
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 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(); }
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 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 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 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; }
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 = ""; } }