UControl_CutHole.cs 3.4 KB

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