LockCheckBox.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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.Windows.Forms;
  9. using UAS_MES.PublicMethod;
  10. namespace UAS_MES.CustomControl.CustomCheckBox
  11. {
  12. public partial class LockCheckBox : CheckBox
  13. {
  14. /// <summary>
  15. /// 存放工单的控件
  16. /// </summary>
  17. Control MaCtl;
  18. public LockCheckBox()
  19. {
  20. InitializeComponent();
  21. }
  22. public void GetMakeCodeCtl(Control ctl)
  23. {
  24. MaCtl = ctl;
  25. }
  26. public void LockCheckBox_CheckedChanged(object sender, EventArgs e)
  27. {
  28. Console.WriteLine(Checked);
  29. if (Checked)
  30. {
  31. if (MaCtl.Text != "")
  32. {
  33. string ErrorMessage;
  34. if (LogicHandler.CheckMakeStatus(MaCtl.Text, out ErrorMessage))
  35. MaCtl.Enabled = false;
  36. else
  37. {
  38. Checked = false;
  39. BaseUtil.ShowError(ErrorMessage);
  40. }
  41. }
  42. else
  43. {
  44. Checked = false;
  45. BaseUtil.ShowError("工单号不能为空");
  46. }
  47. }
  48. else {
  49. MaCtl.Enabled = true;
  50. MaCtl.Focus();
  51. }
  52. }
  53. }
  54. }