private void FrmRealTimeData_Load(object sender, EventArgs e) { cbxSensor.Items.Clear(); List <string> cameraName = new List <string>(); structSMInfrared_Configs = sqlCreate.Select_All_SMInfrared_ProjConfig(StaticClass.DataBaseName); //全部启用的探测器 foreach (StructClass.StructIAnalyzeConfig InfraredConfig in structSMInfrared_Configs) //把启用的探测器加进去 { if (InfraredConfig.Enable) { cameraName.Add(InfraredConfig.CameraName); } } foreach (string name in cameraName) { cbxSensor.Items.Add(name); } if (cbxSensor.Items.Count > 0) { cbxSensor.SelectedIndex = 0; } else { MessageBox.Show("无可用的探测器!"); } }