UControl_CutHole.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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. //ClearProcessControls();
  39. //显示检测过程信息
  40. UControl_Process uControl_Process = new UControl_Process(FormHOZMainObject);
  41. FormHOZMainObject.plPrarInfo.Width = uControl_Process.Width;
  42. FormHOZMainObject.plPrarInfo.Height = uControl_Process.Height;
  43. uControl_Process.Dock = DockStyle.Fill;
  44. FormHOZMainObject.plPrarInfo.Location = uControl_Process.Location;
  45. FormHOZMainObject.plPrarInfo.Controls.Add(uControl_Process);
  46. FormHOZMainObject.plPrarInfo.Visible = true;
  47. }
  48. private void tsShowParaInfo_Click(object sender, EventArgs e)
  49. {
  50. //显示处理信息
  51. ShowParaControl(UControl_ParaInfo.Name);
  52. //if (FormHOZMainObject.plPrarInfo.Visible)
  53. //{
  54. // FormHOZMainObject.plPrarInfo.Visible = false;
  55. //}
  56. //else
  57. //{
  58. // FormHOZMainObject.plPrarInfo.Visible = true;
  59. //}
  60. FormHOZMainObject.plPrarInfo.Visible = true;
  61. }
  62. /// <summary>
  63. /// 向主界面中的属性层中,添加切孔信息用户控件
  64. /// </summary>
  65. /// <param name="uControl_ParaInfo"></param>
  66. private void AddParaControl(UControl_ParaInfo uControl_ParaInfo)
  67. {
  68. bool isExist = false;
  69. if (FormHOZMainObject.plPrarInfo.Controls.Count == 0)
  70. {
  71. FormHOZMainObject.plPrarInfo.Controls.Add(uControl_ParaInfo);
  72. isExist = true;
  73. }
  74. else
  75. {
  76. foreach (Control item in FormHOZMainObject.plPrarInfo.Controls)
  77. {
  78. if (item is UserControl)
  79. {
  80. if (item.Name == uControl_ParaInfo.Name)
  81. {
  82. isExist = true;
  83. break;
  84. }
  85. }
  86. }
  87. }
  88. if (!isExist)
  89. {
  90. FormHOZMainObject.plPrarInfo.Controls.Add(uControl_ParaInfo);
  91. }
  92. }
  93. private void ShowParaControl(string cutHoleName)
  94. {
  95. foreach (Control item in FormHOZMainObject.plPrarInfo.Controls)
  96. {
  97. if (item is UserControl)
  98. {
  99. if (item.Name == cutHoleName)
  100. {
  101. item.Visible = true;
  102. }
  103. else
  104. {
  105. item.Visible = false;
  106. }
  107. }
  108. }
  109. }
  110. }
  111. }