UControl_CutHole.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. namespace HOZProject
  12. {
  13. public partial class UControl_CutHole : UserControl
  14. {
  15. private string cutHoleName;
  16. public string CutHoleName { get => cutHoleName; set => cutHoleName = value; }
  17. private string cutHoleCode;
  18. public string CutHoleCode { get => cutHoleCode; set => cutHoleCode = value; }
  19. private int cutHoleState;
  20. public int CutHoleState { get => cutHoleState; set => cutHoleState = value; }
  21. private FormHOZMain formHOZMain;
  22. public FormHOZMain FormHOZMainObject { get => formHOZMain; set => formHOZMain = value; }
  23. private UControl_ParaInfo uControl_ParaInfo;
  24. public UControl_ParaInfo UControl_ParaInfo { get => uControl_ParaInfo; set => uControl_ParaInfo = value; }
  25. public UControl_CutHole(FormHOZMain formHOZ)
  26. {
  27. InitializeComponent();
  28. FormHOZMainObject = formHOZ;
  29. }
  30. private void UContrl_CutHole_Load(object sender, EventArgs e)
  31. {
  32. btnCutHole.Text = CutHoleName;
  33. }
  34. private void tsShowProcess_Click(object sender, EventArgs e)
  35. {
  36. //ClearProcessControls();
  37. //显示检测过程信息
  38. UControl_Process uControl_Process = new UControl_Process(FormHOZMainObject);
  39. FormHOZMainObject.plPrarInfo.Width = uControl_Process.Width;
  40. FormHOZMainObject.plPrarInfo.Height = uControl_Process.Height;
  41. uControl_Process.Dock = DockStyle.Fill;
  42. FormHOZMainObject.plPrarInfo.Location = uControl_Process.Location;
  43. FormHOZMainObject.plPrarInfo.Controls.Add(uControl_Process);
  44. FormHOZMainObject.plPrarInfo.Visible = true;
  45. }
  46. private void tsShowParaInfo_Click(object sender, EventArgs e)
  47. {
  48. //显示处理信息
  49. ShowParaControl(UControl_ParaInfo.Name);
  50. FormHOZMainObject.plPrarInfo.Visible = true;
  51. }
  52. /// <summary>
  53. /// 向主界面中的属性层中,添加切孔信息用户控件
  54. /// </summary>
  55. /// <param name="uControl_ParaInfo"></param>
  56. private void AddParaControl(UControl_ParaInfo uControl_ParaInfo)
  57. {
  58. bool isExist = false;
  59. if (FormHOZMainObject.plPrarInfo.Controls.Count == 0)
  60. {
  61. FormHOZMainObject.plPrarInfo.Controls.Add(uControl_ParaInfo);
  62. isExist = true;
  63. }
  64. else
  65. {
  66. foreach (Control item in FormHOZMainObject.plPrarInfo.Controls)
  67. {
  68. if (item is UserControl)
  69. {
  70. if (item.Name == uControl_ParaInfo.Name)
  71. {
  72. isExist = true;
  73. break;
  74. }
  75. }
  76. }
  77. }
  78. if (!isExist)
  79. {
  80. FormHOZMainObject.plPrarInfo.Controls.Add(uControl_ParaInfo);
  81. }
  82. }
  83. private void ShowParaControl(string cutHoleName)
  84. {
  85. foreach (Control item in FormHOZMainObject.plPrarInfo.Controls)
  86. {
  87. if (item is UserControl)
  88. {
  89. if (item.Name == cutHoleName)
  90. {
  91. item.Visible = true;
  92. }
  93. else
  94. {
  95. item.Visible = false;
  96. }
  97. }
  98. }
  99. }
  100. }
  101. }