UControl_CutHole.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. if (FormHOZMainObject.plPrarInfo.Visible)
  51. {
  52. FormHOZMainObject.plPrarInfo.Visible = false;
  53. }
  54. else
  55. {
  56. FormHOZMainObject.plPrarInfo.Visible = true;
  57. }
  58. }
  59. /// <summary>
  60. /// 向主界面中的属性层中,添加切孔信息用户控件
  61. /// </summary>
  62. /// <param name="uControl_ParaInfo"></param>
  63. private void AddParaControl(UControl_ParaInfo uControl_ParaInfo)
  64. {
  65. bool isExist = false;
  66. if (FormHOZMainObject.plPrarInfo.Controls.Count == 0)
  67. {
  68. FormHOZMainObject.plPrarInfo.Controls.Add(uControl_ParaInfo);
  69. isExist = true;
  70. }
  71. else
  72. {
  73. foreach (Control item in FormHOZMainObject.plPrarInfo.Controls)
  74. {
  75. if (item is UserControl)
  76. {
  77. if (item.Name == uControl_ParaInfo.Name)
  78. {
  79. isExist = true;
  80. break;
  81. }
  82. }
  83. }
  84. }
  85. if (!isExist)
  86. {
  87. FormHOZMainObject.plPrarInfo.Controls.Add(uControl_ParaInfo);
  88. }
  89. }
  90. private void ShowParaControl(string cutHoleName)
  91. {
  92. foreach (Control item in FormHOZMainObject.plPrarInfo.Controls)
  93. {
  94. if (item is UserControl)
  95. {
  96. if (item.Name == cutHoleName)
  97. {
  98. item.Visible = true;
  99. }
  100. else
  101. {
  102. item.Visible = false;
  103. }
  104. }
  105. }
  106. }
  107. }
  108. }