private void btnSavePlan_Click(object sender, EventArgs e) { FrmInputPlanName frm = new FrmInputPlanName(_camera1); if (frm.ShowDialog() != DialogResult.OK) { return; } //方案 List <CameraParamPlanEntity> settingPlans = _camera1.GetCameraParamPlans(); cmbSettings.DataSource = settingPlans; cmbSettings.DisplayMember = nameof(CameraParamPlanEntity.ParamPlanName); cmbSettings.SelectedIndexChanged -= cmbResolution_SelectedIndexChanged; cmbSettings.SelectedItem = settingPlans.Find(m => m.DefaultSetting == true); cmbSettings.SelectedIndexChanged += cmbResolution_SelectedIndexChanged; }
private void menu_savePlan_Click(object sender, EventArgs e) { FrmInputPlanName frm = new FrmInputPlanName(camera); if (frm.ShowDialog() == DialogResult.OK) { //获取方案 List <CameraParamPlanEntity> plans = camera.GetCameraParamPlans(); menuPlan.DropDownItems.Clear(); for (int i = 0; i < plans.Count; i++) { var item = plans[i]; ToolStripMenuItem s_item = new ToolStripMenuItem(); s_item.Name = "plan_" + i; s_item.Text = item.ParamPlanName; s_item.CheckOnClick = true; s_item.Tag = item; s_item.Checked = item.DefaultSetting == true; s_item.CheckedChanged += plan_CheckChanged; menuPlan.DropDownItems.Add(s_item); } } }