UControl_CutHole.cs 3.9 KB

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