private void Set_Line(Button btnAdd_Line, TextBox tbxLine_X1, TextBox tbxLine_Y1, TextBox tbxLine_X2, TextBox tbxLine_Y2, TextBox tbxLine_X3, TextBox tbxLine_Y3, TextBox tbxLine_Emiss, Button btnClear_Line) { if (btnAdd_Line.Text == "编辑") { IsSet_Line = true; tbxLine_X1.Enabled = true; tbxLine_Y1.Enabled = true; tbxLine_X2.Enabled = true; tbxLine_Y2.Enabled = true; tbxLine_X3.Enabled = true; tbxLine_Y3.Enabled = true; tbxLine_Emiss.Enabled = true; btnAdd_Line.Text = "确认"; btnClear_Line.Text = "取消"; Create_Pbx(); foreach (Control control in pnlBtnLine.Controls) { control.Enabled = false; } btnAdd_Line.Enabled = true; btnClear_Line.Enabled = true; tabSpot.Enabled = false; tabAreas.Enabled = false; } else if (btnAdd_Line.Text == "确认") { try { int x1 = Convert.ToInt32(tbxLine_X1.Text); int y1 = Convert.ToInt32(tbxLine_Y1.Text); int x2 = Convert.ToInt32(tbxLine_X2.Text); int y2 = Convert.ToInt32(tbxLine_Y2.Text); int x3 = Convert.ToInt32(tbxLine_X3.Text); int y3 = Convert.ToInt32(tbxLine_Y3.Text); int emiss = Convert.ToInt32(tbxLine_Emiss.Text); if (x1 <= 0 || x1 > 320 || y1 <= 0 || y1 > 240 || x2 <= 0 || x2 > 320 || y2 <= 0 || y2 > 240) { MessageBox.Show("请输入合适的坐标"); return; } if (tbxLine_X1.Enabled) { type = "L1"; DMSDK.DM_SetLine(StaticClass.tempConnect, 1, x1, y1, x2, y2, ((x1 + x2) / 2) - 2, ((y1 + y2) / 2) - 4, emiss); sqlCreate.Update_Line(StaticClass.Temper_CameraId, "L1", x1, y1, x2, y2, (x1 + x2) / 2, (y1 + y2) / 2, emiss, StaticClass.DataBaseName); } Cancel_SetLine(type, btnAdd_Line, tbxLine_X1, tbxLine_Y1, tbxLine_X2, tbxLine_Y2, tbxLine_X3, tbxLine_Y3, tbxLine_Emiss, btnClear_Line); } catch (Exception ex) { MessageBox.Show(ex.Message + "设置测温线失败!"); } } }