private void 建立匹配ModelToolStripMenuItem_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 = "CreateMatchingModel"; p.Setornot = false; p.ProcedureMethod = (int)procedure_M.CreateMatchingModel; p.SettingForm = new CreateMatchingModel(); Camera[0].Procedure.Insert(cm.Position + 1, p); Camera[0].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(0); }
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; Camera[0].Procedure.Insert(cm.Position + 1, p); Camera[0].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(0); }