LockCheckBox.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. if (Checked)
  29. {
  30. if (MaCtl.Text != "")
  31. {
  32. string ErrorMessage;
  33. if (LogicHandler.CheckMakeStatus(MaCtl.Text, out ErrorMessage))
  34. MaCtl.Enabled = false;
  35. else
  36. {
  37. Checked = false;
  38. BaseUtil.ShowError(ErrorMessage);
  39. }
  40. }
  41. else
  42. {
  43. Checked = false;
  44. BaseUtil.ShowError("工单号不能为空");
  45. }
  46. }
  47. else {
  48. MaCtl.Enabled = true;
  49. MaCtl.Focus();
  50. }
  51. }
  52. }
  53. }