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; }
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; }
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 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); } }