private void 二維量測EllipseToolStripMenuItem_Click(object sender, EventArgs e) { //控制項目前cell位置 CurrencyManager cm = (CurrencyManager)this.BindingContext[ProcedureTable.DataSource]; //設定Procedure_Table顯示字串 Procedure_Table p = new Procedure_Table(); Object_Table O = new Object_Table(); p.ProcedureName = "Measure_2D_Eillpse"; p.Setornot = false; p.ProcedureMethod = (int)procedure_M.Measure_2D_Ellipse; p.SettingForm = new Measure_2D_Ellipse(); Camera.Procedure.Insert(cm.Position + 1, p); Camera.Object.Insert(cm.Position + 1, O); //重新排序Procedure編號 remarkProcedure(0); //更新表格 if (cm != null) { cm.Refresh(); ProcedureTable.ClearSelection(); if (ProcedureTable.RowCount < cm.Position + 1) { ProcedureTable.Rows[cm.Position + 1].Selected = true; } else { ProcedureTable.Rows[cm.Position].Selected = true; } } setProcedurecolor(); }
int clk = 0;//載入圖片序數 private void 載入圖片ToolStripMenuItem_Click(object sender, EventArgs e) { //控制項目前cell位置 CurrencyManager cm = (CurrencyManager)this.BindingContext[ProcedureTable.DataSource]; //設定Procedure_Table顯示字串 Procedure_Table p = new Procedure_Table(); Object_Table O = new Object_Table(); p.ProcedureName = "載入圖片" + clk; p.Setornot = false; p.ProcedureMethod = (int)procedure_M.readimage; O.ImageName = "載入圖片" + clk; Camera.Procedure.Insert(cm.Position + 1, p); Camera.Object.Insert(cm.Position + 1, O); clk++; //重新排序Procedure編號 remarkProcedure(0); //更新表格 if (cm != null) { //更新表單(會將所有設定清除....) cm.Refresh(); //新增之後將cm移至新增的項目上 ProcedureTable.ClearSelection(); if (ProcedureTable.RowCount < cm.Position + 1) { ProcedureTable.Rows[cm.Position + 1].Selected = true; } else { ProcedureTable.Rows[cm.Position].Selected = true; } } //設定Procedurecolor 依照是否已經設定好參數 setProcedurecolor(); }