Beispiel #1
0
 private void Set_Area(Button btnAdd_Area, TextBox tbxArea_X1, TextBox tbxArea_Y1, TextBox tbxArea_X2, TextBox tbxArea_Y2, TextBox tbxArea_Emiss, ComboBox cbxMeasureType, Button btnClear_Area) //设置测温区域
 {
     if (btnAdd_Area.Text == "编辑")                                                                                                                                                               //C++中将画面绑定到控件上了 无法在画面中动态的绘制矩形  转而为 截图绘制。
     {
         IsSet_Area             = true;
         tbxArea_X1.Enabled     = true;
         tbxArea_Y1.Enabled     = true;
         tbxArea_X2.Enabled     = true;
         tbxArea_Y2.Enabled     = true;
         tbxArea_Emiss.Enabled  = true;
         cbxMeasureType.Enabled = true;
         btnAdd_Area.Text       = "确认";
         btnClear_Area.Text     = "取消";
         Create_Pbx();
         foreach (Control control in pnlBtnArea.Controls)
         {
             control.Enabled = false;
         }
         btnAdd_Area.Enabled   = true;
         btnClear_Area.Enabled = true;
         tabSpot.Enabled       = false;
         tabLine.Enabled       = false;
     }
     else if (btnAdd_Area.Text == "确认")
     {
         try
         {
             if (cbxMeasureType.SelectedIndex == -1)
             {
                 MessageBox.Show("请选择区域测温方式!");
                 return;
             }
             int x1          = Convert.ToInt32(tbxArea_X1.Text);
             int y1          = Convert.ToInt32(tbxArea_Y1.Text);
             int x2          = Convert.ToInt32(tbxArea_X2.Text);
             int y2          = Convert.ToInt32(tbxArea_Y2.Text);
             int emiss       = Convert.ToInt32(tbxArea_Emiss.Text);
             int messuretype = Convert.ToInt32(cbxMeasureType.SelectedIndex);
             if (x1 < 0 || x1 > 320 || y1 < 0 || y1 > 240 || x2 < 0 || x2 > 320 || y2 < 0 || y2 > 240)
             {
                 MessageBox.Show("请输入合适的坐标");
                 return;
             }
             if (tbxArea_1_X1.Enabled)
             {
                 type = "A6";
                 DMSDK.DM_SetArea(StaticClass.tempConnect, 6, x1, y1, x2, y2, emiss, messuretype);
                 sqlCreate.Update_Area(StaticClass.Temper_CameraId, "A6", x1, y1, x2, y2, emiss, messuretype, StaticClass.DataBaseName);
             }
             else if (tbxArea_2_X1.Enabled)
             {
                 type = "A7";
                 DMSDK.DM_SetArea(StaticClass.tempConnect, 7, x1, y1, x2, y2, emiss, messuretype);
                 sqlCreate.Update_Area(StaticClass.Temper_CameraId, "A7", x1, y1, x2, y2, emiss, messuretype, StaticClass.DataBaseName);
             }
             else if (tbxArea_3_X1.Enabled)
             {
                 type = "A8";
                 DMSDK.DM_SetArea(StaticClass.tempConnect, 8, x1, y1, x2, y2, emiss, messuretype);
                 sqlCreate.Update_Area(StaticClass.Temper_CameraId, "A8", x1, y1, x2, y2, emiss, messuretype, StaticClass.DataBaseName);
             }
             else if (tbxArea_4_X1.Enabled)
             {
                 type = "A9";
                 DMSDK.DM_SetArea(StaticClass.tempConnect, 9, x1, y1, x2, y2, emiss, messuretype);
                 sqlCreate.Update_Area(StaticClass.Temper_CameraId, "A9", x1, y1, x2, y2, emiss, messuretype, StaticClass.DataBaseName);
             }
             Cancel_SetArea(type, btnAdd_Area, tbxArea_X1, tbxArea_Y1, tbxArea_X2, tbxArea_Y2, tbxArea_Emiss, cbxMeasureType, btnClear_Area);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message + "设置测温区域失败!");
         }
     }
 }