UserControl5.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. namespace IMCS.UControl
  11. {
  12. public partial class UserControl5 : UserControl
  13. {
  14. public UserControl5()
  15. {
  16. InitializeComponent();
  17. this.Load += (s, e) =>
  18. {
  19. Init();
  20. Label_SetColor(new int[] { 1,4,5,20,9});
  21. this.SizeChanged += (t, k) =>
  22. {
  23. this.tableLayoutPanel3.SetRowSpan(this.uctrl_Boot, 5);
  24. var cc = (this.pan_botton.Width ) - this.tableLayoutPanel1.Width;
  25. if (cc > 500)
  26. {
  27. this.tableLayoutPanel1.Width += 300;
  28. this.pan_botton.Padding = new Padding(0, 0, 100, 0);
  29. }
  30. else if (cc < 100)
  31. {
  32. this.tableLayoutPanel1.Width -= 300;
  33. this.pan_botton.Padding = new Padding(0, 0, 0, 0);
  34. }
  35. };
  36. };
  37. }
  38. private void Init()
  39. {
  40. #region AGV接驳位H
  41. uctl_agvh.deviceStateDefaultList.Device_Name = "AGV接驳位-H";
  42. uctl_agvh.deviceStateDefaultList.Device_OnLine =true;
  43. uctl_agvh.deviceStateDefaultList.Device_ConnectionMes = true;
  44. uctl_agvh.deviceStateDefaultList.Device_Runing = DefaultList.EnumDeviceRunState.RunState_Run;
  45. uctl_agvh.deviceStateDefaultList.Device_Pan = DefaultList.EnumPlateNum.Plate_Zero;
  46. #endregion
  47. #region AGV接驳位-L
  48. uctl_agvl.deviceStateDefaultList.Device_Name = "AGV接驳位-L";
  49. uctl_agvl.deviceStateDefaultList.Device_OnLine = true;
  50. uctl_agvl.deviceStateDefaultList.Device_ConnectionMes = true;
  51. uctl_agvl.deviceStateDefaultList.Device_Runing = DefaultList.EnumDeviceRunState.RunState_Run;
  52. uctl_agvl.deviceStateDefaultList.Device_Pan = DefaultList.EnumPlateNum.Plate_One;
  53. #endregion
  54. #region 柔性线清洗机
  55. uctl_clean.deviceStateDefaultList.Device_Name = "柔性线清洗机";
  56. uctl_clean.deviceStateDefaultList.Device_Pan = DefaultList.EnumPlateNum.Plate_Zero;
  57. uctl_clean.deviceStateDefaultList.Device_OnLine = true;
  58. uctl_clean.deviceStateDefaultList.Device_ConnectionMes = true;
  59. uctl_clean.deviceStateDefaultList.Device_Runing = DefaultList.EnumDeviceRunState.RunState_Run;
  60. #endregion
  61. #region SMU50-5
  62. uctl_machine.deviceStateDefaultList.Device_Name = "SMU50-5";
  63. uctl_machine.deviceStateDefaultList.Device_OnLine = true;
  64. uctl_machine.deviceStateDefaultList.Device_ConnectionMes = true;
  65. uctl_machine.deviceStateDefaultList.Device_Runing = DefaultList.EnumDeviceRunState.RunState_Err;
  66. #endregion
  67. #region 柔性线打标机
  68. uctl_print.deviceStateDefaultList.Device_Name = "柔性线打标机";
  69. uctl_print.deviceStateDefaultList.Device_OnLine = true;
  70. uctl_print.deviceStateDefaultList.Device_ConnectionMes = true;
  71. uctl_print.deviceStateDefaultList.Device_Runing = DefaultList.EnumDeviceRunState.RunState_Run;
  72. #endregion
  73. #region 六轴机器人
  74. uctrl_Boot.deviceStateDefaultList.Device_Name = "六轴机器人";
  75. uctrl_Boot.deviceStateDefaultList.Device_OnLine = true;
  76. uctrl_Boot.deviceStateDefaultList.Device_ConnectionMes = true;
  77. uctrl_Boot.deviceStateDefaultList.Device_Runing = DefaultList.EnumDeviceRunState.RunState_Wait;
  78. #endregion
  79. }
  80. private void Label_SetColor(string tagvalue,bool isonine=true)
  81. {
  82. Control[] cls = this.tableLayoutPanel1.Controls.Find($"lb_{tagvalue}", true);
  83. if (cls.Length > 0)
  84. {
  85. if (isonine)
  86. cls[0].BackColor = System.Drawing.Color.FromArgb(51, 153, 204);
  87. else
  88. cls[0].BackColor = System.Drawing.Color.FromArgb(242, 242, 242);
  89. }
  90. }
  91. private void Label_SetColor(int[] vs, bool isonline=true)
  92. {
  93. foreach (var s in vs)
  94. {
  95. Label_SetColor(s.ToString(), isonline);
  96. }
  97. }
  98. }
  99. }