UControl_Init.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Drawing;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using MeasureData;
  11. using System.Configuration;
  12. using FileManager;
  13. using System.IO;
  14. namespace HOZProject
  15. {
  16. public partial class UControl_Init : UserControl
  17. {
  18. #region 全局变量
  19. String[] sT;
  20. String[] firms;
  21. String[] WPZD;
  22. String[] WPZF;
  23. String[] WQGD;
  24. String[] WQGF;
  25. String[] WLZ;
  26. Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
  27. private FormHOZMain formHOZMain;
  28. public FormHOZMain FormHOZMainObject { get => formHOZMain; set => formHOZMain = value; }
  29. //模板路径
  30. private string readConfigPath;
  31. public string ReadConfigPath { get => readConfigPath; set => readConfigPath = value; }
  32. //模板文件默认路径
  33. private string m_TemplateFilePath;
  34. #endregion
  35. #region 构造方法
  36. public UControl_Init(FormHOZMain formHOZ)
  37. {
  38. InitializeComponent();
  39. FormHOZMainObject = formHOZ;
  40. }
  41. #endregion
  42. private void UControl_Init_Load(object sender, EventArgs e)
  43. {
  44. }
  45. #region 关闭窗体
  46. private void btnClose_Click(object sender, EventArgs e)
  47. {
  48. Form fParent = this.ParentForm;
  49. fParent.Close();
  50. }
  51. #endregion
  52. #region 加载切孔文件,生成切孔列表
  53. private void pbCutHoleFile_Click(object sender, EventArgs e)
  54. {
  55. if (FormHOZMainObject.m_MeasureFile == null)
  56. {
  57. MessageBox.Show("请新建一个测量文件");
  58. }
  59. else
  60. {
  61. if (!FormHOZMainObject.m_MeasureFile.GetCutHolesFromFile(""))
  62. {
  63. MessageBox.Show("导入切孔失败");
  64. }
  65. else
  66. {
  67. List<CutHole> ListCutHole = FormHOZMainObject.m_MeasureFile.ListCutHole;
  68. //文件路径
  69. string CutHoleFilePath = FormHOZMainObject.m_MeasureFile.CutHoleFilePath;
  70. FormHOZMainObject.CreateCutHoleList(ListCutHole);
  71. //显示导入的切孔数量
  72. lblCutHoleCount.Text = string.Format("成功导入{0}个切孔", ListCutHole.Count);
  73. tbCutHoleFilePath.Text = CutHoleFilePath;
  74. }
  75. }
  76. }
  77. #endregion
  78. #region 根据一个切孔文件,自动计算其他切孔信息
  79. /// <summary>
  80. /// 根据一个切孔,自动计算其他切孔信息
  81. /// </summary>
  82. /// <param name="sender"></param>
  83. /// <param name="e"></param>
  84. private void pbCutHoleAuto_Click(object sender, EventArgs e)
  85. {
  86. }
  87. #endregion
  88. #region 加载PT模板文件
  89. private void pbTemplateFile_Click(object sender, EventArgs e)
  90. {
  91. string FilePathName;
  92. string fileNameWithoutExtension;
  93. //新建一个文件对话框
  94. OpenFileDialog pOpenFileDialog = new OpenFileDialog();
  95. //设置对话框标题
  96. pOpenFileDialog.Title = "选择模板文件";
  97. //设置打开文件类型
  98. pOpenFileDialog.Filter = "ely文件(*.ely)|*.ely";
  99. ////监测文件是否存在
  100. //pOpenFileDialog.CheckFileExists = true;
  101. //文件打开后执行以下程序
  102. if (pOpenFileDialog.ShowDialog() == DialogResult.OK)
  103. {
  104. FilePathName = System.IO.Path.GetFullPath(pOpenFileDialog.FileName); //绝对路径
  105. fileNameWithoutExtension = System.IO.Path.GetFileNameWithoutExtension(FilePathName);
  106. this.txtWPTF.Text = FilePathName;
  107. }
  108. }
  109. #endregion
  110. #region 加载FIB模板文件
  111. private void pbFIBTemplateFile_Click(object sender, EventArgs e)
  112. {
  113. string FilePathName;
  114. string fileNameWithoutExtension;
  115. //新建一个文件对话框
  116. OpenFileDialog pOpenFileDialog = new OpenFileDialog();
  117. //设置对话框标题
  118. pOpenFileDialog.Title = "选择模板文件";
  119. //设置打开文件类型
  120. pOpenFileDialog.Filter = "ely文件(*.ely)|*.ely";
  121. ////监测文件是否存在
  122. //pOpenFileDialog.CheckFileExists = true;
  123. //文件打开后执行以下程序
  124. if (pOpenFileDialog.ShowDialog() == DialogResult.OK)
  125. {
  126. FilePathName = System.IO.Path.GetFullPath(pOpenFileDialog.FileName); //绝对路径
  127. fileNameWithoutExtension = System.IO.Path.GetFileNameWithoutExtension(FilePathName);
  128. this.txtWFIBF.Text = FilePathName;
  129. }
  130. }
  131. #endregion
  132. #region 创建与读取样品参数、配置文件
  133. private void btnCreateConfig_Click(object sender, EventArgs e)
  134. {
  135. SaveTemplateFile();
  136. }
  137. /// <summary>
  138. /// 获取测量参数,初始化窗体中的控件信息
  139. /// </summary>
  140. /// <returns></returns>
  141. public MeasureParam GetMeasureParamInfo()
  142. {
  143. MeasureParam cfm = new MeasureParam();
  144. cfm.Is_Photograph = chkWIsP.Checked;
  145. cfm.PT = chkWPT.Checked;
  146. cfm.PTTemp = txtWPTF.Text;
  147. cfm.FIBTemp = txtWFIBF.Text;
  148. cfm.Stretch_Magnification = Convert.ToSingle(cbbWLZ.Text);
  149. cfm.Location_Magnification = Convert.ToSingle(cbbWQGF.Text);
  150. cfm.Location_Voltage = Convert.ToSingle(cbbWQGD.Text);
  151. cfm.Photograph_Magnification = Convert.ToSingle(cbbWPZF.Text);
  152. cfm.Photograph_Voltage = Convert.ToSingle(cbbWPZD.Text);
  153. if (cbbWXZ.SelectedIndex == 0)
  154. {
  155. cfm.Correction_Angle = 36;
  156. }
  157. else
  158. {
  159. cfm.Correction_Angle = 54;
  160. }
  161. cfm.SampleName = cbbWYP.Text;
  162. cfm.Firm = cbbWCS.Text;
  163. return cfm;
  164. }
  165. public void SaveTemplateFile()
  166. {
  167. MeasureParam cfm = new MeasureParam();
  168. cfm.Is_Photograph = chkWIsP.Checked;
  169. cfm.PT = chkWPT.Checked;
  170. cfm.PTTemp = txtWPTF.Text;
  171. cfm.FIBTemp = txtWFIBF.Text;
  172. cfm.Stretch_Magnification = Convert.ToSingle(cbbWLZ.Text);
  173. cfm.Location_Magnification = Convert.ToSingle(cbbWQGF.Text);
  174. cfm.Location_Voltage = Convert.ToSingle(cbbWQGD.Text);
  175. cfm.Photograph_Magnification = Convert.ToSingle(cbbWPZF.Text);
  176. cfm.Photograph_Voltage = Convert.ToSingle(cbbWPZD.Text);
  177. if (cbbWXZ.SelectedIndex == 0)
  178. {
  179. cfm.Correction_Angle = 36;
  180. }
  181. else
  182. {
  183. cfm.Correction_Angle = 54;
  184. }
  185. cfm.SampleName = cbbWYP.Text;
  186. cfm.Firm = cbbWCS.Text;
  187. ConfigFile cf = new ConfigFile(cfm);
  188. if (!m_TemplateFilePath.Equals(""))
  189. {
  190. if (!Directory.Exists(m_TemplateFilePath))
  191. {
  192. //创建路径
  193. Directory.CreateDirectory(m_TemplateFilePath);
  194. }
  195. }
  196. SaveFileDialog saveFileDialog = new SaveFileDialog();
  197. //设置默认打开路径(绝对路径)
  198. saveFileDialog.InitialDirectory = m_TemplateFilePath;
  199. saveFileDialog.Filter = "样品参数文件|*.cfg";
  200. if (saveFileDialog.ShowDialog() == DialogResult.OK)
  201. {
  202. cf.Save(saveFileDialog.FileName);
  203. }
  204. else
  205. {
  206. return;
  207. }
  208. //编辑Config文件
  209. EditConfig();
  210. }
  211. /// <summary>
  212. /// 编辑confing 文件信息
  213. /// </summary>
  214. public bool EditConfig()
  215. {
  216. try
  217. {
  218. //设置数据源信息
  219. //样品类型
  220. List<String> _sT = sT.ToList();
  221. if (_sT.IndexOf(cbbWYP.Text) < 0)
  222. {
  223. _sT.Add(cbbWYP.Text);
  224. string wsT = string.Join(",", _sT.ToArray());
  225. config.AppSettings.Settings["Sample_Type"].Value = wsT;
  226. }
  227. //厂商
  228. List<String> _firms = firms.ToList();
  229. if (_firms.IndexOf(cbbWCS.Text) < 0)
  230. {
  231. _firms.Add(cbbWCS.Text);
  232. string wFirms = string.Join(",", _firms.ToArray());
  233. config.AppSettings.Settings["Firm"].Value = wFirms;
  234. }
  235. //拍照电压
  236. List<String> _WPZD = WPZD.ToList();
  237. if (_WPZD.IndexOf(cbbWPZD.Text) < 0)
  238. {
  239. _WPZD.Add(cbbWPZD.Text);
  240. string wWPZD = string.Join(",", _WPZD.ToArray());
  241. config.AppSettings.Settings["WPZD"].Value = wWPZD;
  242. }
  243. //拍照放大位数
  244. List<String> _WPZF = WPZF.ToList();
  245. if (_WPZF.IndexOf(cbbWPZF.Text) < 0)
  246. {
  247. _WPZF.Add(cbbWPZF.Text);
  248. string wWPZF = string.Join(",", _WPZF.ToArray());
  249. config.AppSettings.Settings["WPZF"].Value = wWPZF;
  250. }
  251. //定位切割电压
  252. List<String> _WQGD = WQGD.ToList();
  253. if (_WQGD.IndexOf(cbbWQGD.Text) < 0)
  254. {
  255. _WQGD.Add(cbbWQGD.Text);
  256. string wWQGD = string.Join(",", _WQGD.ToArray());
  257. config.AppSettings.Settings["WQGD"].Value = wWQGD;
  258. }
  259. //定位切割放大位数
  260. List<String> _WQGF = WQGF.ToList();
  261. if (_WQGF.IndexOf(cbbWQGF.Text) < 0)
  262. {
  263. _WQGF.Add(cbbWQGF.Text);
  264. string wWQGF = string.Join(",", _WQGF.ToArray());
  265. config.AppSettings.Settings["WQGF"].Value = wWQGF;
  266. }
  267. //拉直操作放大位数
  268. List<String> _WLZ = WLZ.ToList();
  269. if (_WLZ.IndexOf(cbbWLZ.Text) < 0)
  270. {
  271. _WLZ.Add(cbbWLZ.Text);
  272. string wWLZ = string.Join(",", _WLZ.ToArray());
  273. config.AppSettings.Settings["WLZ"].Value = wWLZ;
  274. }
  275. MeasureParam cfm = new MeasureParam();
  276. cfm.Is_Photograph = chkWIsP.Checked;
  277. cfm.PT = chkWPT.Checked;
  278. cfm.PTTemp = txtWPTF.Text;
  279. cfm.FIBTemp = txtWFIBF.Text;
  280. cfm.Stretch_Magnification = Convert.ToSingle(cbbWLZ.Text);
  281. cfm.Location_Magnification = Convert.ToSingle(cbbWQGF.Text);
  282. cfm.Location_Voltage = Convert.ToSingle(cbbWQGD.Text);
  283. cfm.Photograph_Magnification = Convert.ToSingle(cbbWPZF.Text);
  284. cfm.Photograph_Voltage = Convert.ToSingle(cbbWPZD.Text);
  285. if (cbbWXZ.SelectedIndex == 0)
  286. {
  287. cfm.Correction_Angle = 36;
  288. }
  289. else
  290. {
  291. cfm.Correction_Angle = 54;
  292. }
  293. cfm.SampleName = cbbWYP.Text;
  294. cfm.Firm = cbbWCS.Text;
  295. //设置配置文件默认值
  296. config.AppSettings.Settings["Is_Photograph"].Value = cfm.Is_Photograph.ToString();
  297. config.AppSettings.Settings["PT_Depostion"].Value = cfm.PT.ToString();
  298. config.AppSettings.Settings["PT_ELYFile"].Value = cfm.PTTemp;
  299. config.AppSettings.Settings["FIB_ELYFile"].Value = cfm.FIBTemp;
  300. config.AppSettings.Settings["Stretch_Magnification"].Value = cfm.Stretch_Magnification.ToString();
  301. config.AppSettings.Settings["Location_Magnification"].Value = cfm.Location_Magnification.ToString();
  302. config.AppSettings.Settings["Location_Voltage"].Value = cfm.Location_Voltage.ToString();
  303. config.AppSettings.Settings["Photograph_Magnification"].Value = cfm.Photograph_Magnification.ToString();
  304. config.AppSettings.Settings["Photograph_Voltage"].Value = cfm.Photograph_Voltage.ToString();
  305. config.AppSettings.Settings["Correction_Angle"].Value = cfm.Correction_Angle.ToString();
  306. config.AppSettings.Settings["SampleName"].Value = cfm.SampleName;
  307. config.AppSettings.Settings["Firms"].Value = cfm.Firm;
  308. config.Save(ConfigurationSaveMode.Modified);
  309. ConfigurationManager.RefreshSection("appSettings");//重新加载新的配置文件
  310. return true;
  311. }
  312. catch (Exception ex)
  313. {
  314. LogManager.LogError(ex.Message);
  315. return false;
  316. }
  317. }
  318. /// <summary>
  319. /// 删除config文件节点中内容信息
  320. /// </summary>
  321. public bool DelConfigNodeContentInfo(string delControlName, string selName)
  322. {
  323. try
  324. {
  325. switch (delControlName)
  326. {
  327. case "WYP":
  328. //样品类型
  329. List<String> _sT = sT.ToList();
  330. _sT.Remove(selName);
  331. string wsT = string.Join(",", _sT.ToArray());
  332. config.AppSettings.Settings["Sample_Type"].Value = wsT;
  333. break;
  334. case "WCS":
  335. //厂商
  336. List<String> _firms = firms.ToList();
  337. _firms.Remove(selName);
  338. string wFirms = string.Join(",", _firms.ToArray());
  339. config.AppSettings.Settings["Firm"].Value = wFirms;
  340. break;
  341. case "WPZD":
  342. //拍照电压
  343. List<String> _WPZD = WPZD.ToList();
  344. _WPZD.Remove(selName);
  345. string wWPZD = string.Join(",", _WPZD.ToArray());
  346. config.AppSettings.Settings["WPZD"].Value = wWPZD;
  347. break;
  348. case "WPZF":
  349. //拍照放大位数
  350. List<String> _WPZF = WPZF.ToList();
  351. _WPZF.Remove(selName);
  352. string wWPZF = string.Join(",", _WPZF.ToArray());
  353. config.AppSettings.Settings["WPZF"].Value = wWPZF;
  354. break;
  355. case "WQGD"://定位切割电压
  356. List<String> _WQGD = WQGD.ToList();
  357. _WQGD.Remove(selName);
  358. string wWQGD = string.Join(",", _WQGD.ToArray());
  359. config.AppSettings.Settings["WQGD"].Value = wWQGD;
  360. break;
  361. case "WQGF": //定位切割放大位数
  362. List<String> _WQGF = WQGF.ToList();
  363. _WQGF.Remove(selName);
  364. string wWQGF = string.Join(",", _WQGF.ToArray());
  365. config.AppSettings.Settings["WQGF"].Value = wWQGF;
  366. break;
  367. case "WLZ":
  368. //拉直操作放大位数
  369. List<String> _WLZ = WLZ.ToList();
  370. _WLZ.Remove(selName);
  371. string wWLZ = string.Join(",", _WLZ.ToArray());
  372. config.AppSettings.Settings["WLZ"].Value = wWLZ;
  373. break;
  374. }
  375. config.Save(ConfigurationSaveMode.Modified);
  376. ConfigurationManager.RefreshSection("appSettings");//重新加载新的配置文件
  377. return true;
  378. }
  379. catch (Exception ex)
  380. {
  381. LogManager.LogError(ex.Message);
  382. return true;
  383. }
  384. }
  385. /// <summary>
  386. /// 绑定下拉菜单
  387. /// </summary>
  388. /// <param name="cb"></param>
  389. /// <param name="strGroup"></param>
  390. private void BindComboxData(ComboBox cb, string[] strGroup)
  391. {
  392. for (int i = 0; i < strGroup.Length; i++)
  393. {
  394. if (!strGroup[i].Equals(""))
  395. {
  396. cb.Items.Add(strGroup[i]);
  397. }
  398. }
  399. }
  400. /// <summary>
  401. /// 读取Config文件信息
  402. /// </summary>
  403. public void ReloadConfig()
  404. {
  405. cbbWYP.Items.Clear();
  406. cbbWCS.Items.Clear();
  407. cbbWPZD.Items.Clear();
  408. cbbWPZF.Items.Clear();
  409. cbbWQGD.Items.Clear();
  410. cbbWQGF.Items.Clear();
  411. cbbWLZ.Items.Clear();
  412. m_TemplateFilePath = config.AppSettings.Settings["TemplateFilePath"].Value.ToString();
  413. string sample_Type = config.AppSettings.Settings["Sample_Type"].Value.ToString();
  414. string firm = config.AppSettings.Settings["Firm"].Value.ToString();
  415. string WPZDTemp = config.AppSettings.Settings["WPZD"].Value.ToString();
  416. string WPZFTemp = config.AppSettings.Settings["WPZF"].Value.ToString();
  417. string WQGDTemp = config.AppSettings.Settings["WQGD"].Value.ToString();
  418. string WQGFTemp = config.AppSettings.Settings["WQGF"].Value.ToString();
  419. string WLZTemp = config.AppSettings.Settings["WLZ"].Value.ToString();
  420. //样品类型
  421. sT = sample_Type.Split(',');
  422. BindComboxData(cbbWYP, sT);
  423. //厂商
  424. firms = firm.Split(',');
  425. BindComboxData(cbbWCS, firms);
  426. //拍照电压
  427. WPZD = WPZDTemp.Split(',');
  428. BindComboxData(cbbWPZD, WPZD);
  429. //拍照放大位数
  430. WPZF = WPZFTemp.Split(',');
  431. BindComboxData(cbbWPZF, WPZF);
  432. //定位切割电压
  433. WQGD = WQGDTemp.Split(',');
  434. BindComboxData(cbbWQGD, WQGD);
  435. //定位切割放大位数
  436. WQGF = WQGFTemp.Split(',');
  437. BindComboxData(cbbWQGF, WQGF);
  438. //拉直操作放大位数
  439. WLZ = WLZTemp.Split(',');
  440. BindComboxData(cbbWLZ, WLZ);
  441. //设置配置文件默认值
  442. chkWIsP.Checked=Convert.ToBoolean(config.AppSettings.Settings["Is_Photograph"].Value);
  443. chkWPT.Checked = Convert.ToBoolean(config.AppSettings.Settings["PT_Depostion"].Value);
  444. txtWPTF.Text = config.AppSettings.Settings["PT_ELYFile"].Value;
  445. txtWFIBF.Text = config.AppSettings.Settings["FIB_ELYFile"].Value;
  446. cbbWLZ.Text = config.AppSettings.Settings["Stretch_Magnification"].Value;
  447. cbbWQGF.Text = config.AppSettings.Settings["Location_Magnification"].Value;
  448. cbbWQGD.Text = config.AppSettings.Settings["Location_Voltage"].Value;
  449. cbbWPZF.Text = config.AppSettings.Settings["Photograph_Magnification"].Value;
  450. cbbWPZD.Text = config.AppSettings.Settings["Photograph_Voltage"].Value;
  451. string Correction_Angle = config.AppSettings.Settings["Correction_Angle"].Value;
  452. if (Correction_Angle == "36")
  453. {
  454. cbbWXZ.SelectedIndex = 0;
  455. }
  456. else
  457. {
  458. cbbWXZ.SelectedIndex = 1;
  459. }
  460. cbbWYP.Text = config.AppSettings.Settings["SampleName"].Value;
  461. cbbWCS.Text = config.AppSettings.Settings["Firms"].Value;
  462. }
  463. /// <summary>
  464. /// 根据所选路径,读取模板文件
  465. /// </summary>
  466. public void ReadConfigInfo()
  467. {
  468. if (!ReadConfigPath.Equals(""))
  469. {
  470. ReloadConfig();
  471. ConfigFile cfm = new ConfigFile(new MeasureParam());
  472. cfm.Read(ReadConfigPath);
  473. chkWIsP.Checked = cfm.m_Config.Is_Photograph;
  474. chkWPT.Checked = cfm.m_Config.PT;
  475. txtWPTF.Text = cfm.m_Config.PTTemp;
  476. txtWFIBF.Text = cfm.m_Config.FIBTemp;
  477. cbbWLZ.Text = cfm.m_Config.Stretch_Magnification.ToString();
  478. cbbWQGF.Text = cfm.m_Config.Location_Magnification.ToString();
  479. cbbWQGD.Text = cfm.m_Config.Location_Voltage.ToString();
  480. cbbWPZF.Text = cfm.m_Config.Photograph_Magnification.ToString();
  481. cbbWPZD.Text = cfm.m_Config.Photograph_Voltage.ToString();
  482. string Correction_Angle = cfm.m_Config.Correction_Angle.ToString();
  483. if (Correction_Angle == "36")
  484. {
  485. cbbWXZ.SelectedIndex = 0;
  486. }
  487. else
  488. {
  489. cbbWXZ.SelectedIndex = 1;
  490. }
  491. cbbWYP.Text = cfm.m_Config.SampleName;
  492. cbbWCS.Text = cfm.m_Config.Firm;
  493. }
  494. }
  495. /// <summary>
  496. /// 修改配置文件默认值
  497. /// </summary>
  498. /// <param name="sender"></param>
  499. /// <param name="e"></param>
  500. private void btnSaveDefalutPara_Click(object sender, EventArgs e)
  501. {
  502. if (EditConfig())
  503. {
  504. MessageBox.Show("保存成功!", "提示");
  505. }
  506. }
  507. #endregion
  508. #region 删除下拉菜单选择项
  509. private void DelComboBoxItem_Click(object sender, EventArgs e)
  510. {
  511. if (MessageBox.Show("是否删除所选项信息?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
  512. {
  513. PictureBox pbDel = (PictureBox)sender;
  514. string ctrlName = pbDel.Name.Substring(5, pbDel.Name.Length - 5);
  515. if (DelComboBoxItem(ctrlName))
  516. {
  517. //重新加载
  518. ReloadConfig();
  519. }
  520. }
  521. }
  522. /// <summary>
  523. /// 删除下拉菜单选择项
  524. /// </summary>
  525. public bool DelComboBoxItem(string controlName)
  526. {
  527. string delName = controlName;
  528. foreach (Control item in this.Controls)
  529. {
  530. if (item is ComboBox)
  531. {
  532. if (item.Name.Contains(delName))
  533. {
  534. ComboBox cb = (ComboBox)item;
  535. return DelConfigNodeContentInfo(delName, cb.Text);
  536. }
  537. }
  538. }
  539. return false;
  540. }
  541. #endregion
  542. #region 根据是否仅拍照,进行逻辑判断
  543. private void chkWIsP_CheckedChanged(object sender, EventArgs e)
  544. {
  545. if (chkWIsP.Checked)
  546. {
  547. chkWPT.Checked = false;
  548. chkWPT.Visible = false;
  549. }
  550. else
  551. {
  552. chkWPT.Visible = true;
  553. }
  554. }
  555. #endregion
  556. }
  557. }