Пример #1
0
 private void Set_Spot(Button btnAdd_Spot, TextBox tbxSpot_X, TextBox tbxSpot_Y, TextBox tbxSpot_Emiss, Button btnClear_Spot)
 {
     try
     {
         if (btnAdd_Spot.Text == "编辑")
         {
             IsSet_Spot            = true;
             tbxSpot_X.Enabled     = true;
             tbxSpot_Y.Enabled     = true;
             tbxSpot_Emiss.Enabled = true;
             btnAdd_Spot.Text      = "确认";
             btnClear_Spot.Text    = "取消";
             Create_Pbx();
             foreach (Control control in pnlBtnSpot.Controls)
             {
                 control.Enabled = false;
             }
             tabAreas.Enabled      = false;
             tabLine.Enabled       = false;
             btnAdd_Spot.Enabled   = true;
             btnClear_Spot.Enabled = true;
         }
         else if (btnAdd_Spot.Text == "确认")
         {
             int x     = Convert.ToInt32(tbxSpot_X.Text);
             int y     = Convert.ToInt32(tbxSpot_Y.Text);
             int emiss = Convert.ToInt32(tbxSpot_1_Emiss.Text);
             if (x <= 0 || x > 320 || y <= 0 || y > 240)
             {
                 MessageBox.Show("请输入合适的坐标");
                 return;
             }
             if (tbxSpot_1_X.Enabled)
             {
                 type = "S2";
                 DMSDK.DM_SetSpot(StaticClass.tempConnect, 2, x - 2, y - 2, emiss);
                 sqlCreate.Update_Spot(StaticClass.Temper_CameraId, type, x - 2, y - 2, emiss, StaticClass.DataBaseName);
             }
             else if (tbxSpot_2_X.Enabled)
             {
                 type = "S3";
                 DMSDK.DM_SetSpot(StaticClass.tempConnect, 3, x - 2, y - 2, emiss);
                 sqlCreate.Update_Spot(StaticClass.Temper_CameraId, type, x - 2, y - 2, emiss, StaticClass.DataBaseName);
             }
             else if (tbxSpot_3_X.Enabled)
             {
                 type = "S4";
                 DMSDK.DM_SetSpot(StaticClass.tempConnect, 4, x - 2, y - 2, emiss);
                 sqlCreate.Update_Spot(StaticClass.Temper_CameraId, type, x - 2, y - 2, emiss, StaticClass.DataBaseName);
             }
             else if (tbxSpot_4_X.Enabled)
             {
                 type = "S5";
                 DMSDK.DM_SetSpot(StaticClass.tempConnect, 5, x - 2, y - 2, emiss);
                 sqlCreate.Update_Spot(StaticClass.Temper_CameraId, type, x - 2, y - 2, emiss, StaticClass.DataBaseName);
             }
             Cancel_SetSpot(type, btnAdd_Spot, tbxSpot_X, tbxSpot_Y, tbxSpot_Emiss, btnClear_Spot);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + "设置测温点失败!");
     }
 }