LabelWindturbineName.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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 IntelligentControlForsx.Service.WindturbineControl.Domain;
  11. namespace IntelligentControlForsx.MyControls.windturbine
  12. {
  13. public partial class LabelWindturbineName : UserControl
  14. {
  15. public LabelWindturbineName()
  16. {
  17. InitializeComponent();
  18. }
  19. private string windturbineName;
  20. public string WindturbineName
  21. {
  22. set
  23. {
  24. windturbineName = value;
  25. lblWindturbineName.Text = value;
  26. lblWindturbineName.Name = value;
  27. }
  28. get { return windturbineName; }
  29. }
  30. private WindturbineStatus status;
  31. public WindturbineStatus Status
  32. {
  33. set
  34. {
  35. status = value;
  36. switch (value)
  37. {
  38. case WindturbineStatus.Offline:
  39. lblStatus.BackColor = Color.FromArgb(134, 150, 165);
  40. break;
  41. case WindturbineStatus.Start:
  42. lblStatus.BackColor = Color.FromArgb(14, 72, 91);
  43. break;
  44. case WindturbineStatus.Fault:
  45. lblStatus.BackColor = Color.FromArgb(170, 15, 59);
  46. break;
  47. case WindturbineStatus.Maintain:
  48. lblStatus.BackColor = Color.FromArgb(204, 83, 51);
  49. break;
  50. case WindturbineStatus.Stop:
  51. lblStatus.BackColor = Color.FromArgb(176, 151, 63);
  52. break;
  53. case WindturbineStatus.Online:
  54. lblStatus.BackColor = Color.FromArgb(15, 135, 170);
  55. break;
  56. case WindturbineStatus.OnPower:
  57. lblStatus.BackColor = Color.FromArgb(177, 14, 126);
  58. break;
  59. case WindturbineStatus.Standby:
  60. lblStatus.BackColor = Color.FromArgb(15, 141, 106);
  61. break;
  62. default: break;
  63. }
  64. }
  65. get { return status; }
  66. }
  67. public event EventHandler MyClick;
  68. private void lblWindturbineName_Click(object sender, EventArgs e)
  69. {
  70. if (!this.DesignMode)
  71. {
  72. Label lable = (Label)sender;
  73. MyClick(this, e);
  74. }
  75. }
  76. /// <summary>
  77. /// 获取焦点事件
  78. /// </summary>
  79. public void Style_Focus()
  80. {
  81. panel1.BackColor = Color.White;
  82. lblWindturbineName.ForeColor = Color.Black;
  83. }
  84. /// <summary>
  85. /// 失去焦点事件
  86. /// </summary>
  87. public void Style_UnFocus()
  88. {
  89. panel1.BackColor = Color.FromArgb(3, 24, 48);
  90. lblWindturbineName.ForeColor = Color.White;
  91. }
  92. }
  93. }