StatusControl.cs 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  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 System.Drawing.Text;
  11. using IntelligentControlForsx.Code;
  12. namespace IntelligentControlForsx.MyControls
  13. {
  14. public partial class StatusControl : UserControl
  15. {
  16. bool b=false;
  17. public StatusControl()
  18. {
  19. InitializeComponent();
  20. this.tableLayoutPanel1.Name = Guid.NewGuid().ToString();
  21. this.speed.Name = Guid.NewGuid().ToString();
  22. this.power.Name = Guid.NewGuid().ToString();
  23. this.tableLayoutPanel1.MouseEnter += new System.EventHandler(this.tableLayoutPanel1_MouseEnter);
  24. this.tableLayoutPanel1.MouseLeave += new System.EventHandler(this.tableLayoutPanel1_MouseLeave);
  25. this.title.MouseEnter += new System.EventHandler(this.tableLayoutPanel1_MouseEnter);
  26. this.title.MouseLeave += new System.EventHandler(this.tableLayoutPanel1_MouseLeave);
  27. this.speed.MouseEnter += new System.EventHandler(this.tableLayoutPanel1_MouseEnter);
  28. this.speed.MouseLeave += new System.EventHandler(this.tableLayoutPanel1_MouseLeave);
  29. this.power.MouseEnter += new System.EventHandler(this.tableLayoutPanel1_MouseEnter);
  30. this.power.MouseLeave += new System.EventHandler(this.tableLayoutPanel1_MouseLeave);
  31. this.label4.MouseEnter += new System.EventHandler(this.tableLayoutPanel1_MouseEnter);
  32. this.label4.MouseLeave += new System.EventHandler(this.tableLayoutPanel1_MouseLeave);
  33. this.label5.MouseEnter += new System.EventHandler(this.tableLayoutPanel1_MouseEnter);
  34. this.label5.MouseLeave += new System.EventHandler(this.tableLayoutPanel1_MouseLeave);
  35. //this.panel2.MouseEnter += new System.EventHandler(this.tableLayoutPanel1_MouseEnter);
  36. //this.panel2.MouseLeave += new System.EventHandler(this.tableLayoutPanel1_MouseLeave);
  37. //this.panel2.Visible = false;
  38. //string str1 = UserTools.Path + @"\fonts\webfont.ttf";
  39. ////读取字体文件
  40. //PrivateFontCollection pfc = new PrivateFontCollection();
  41. //pfc.AddFontFile(str1);
  42. ////实例化字体
  43. //Font f = new Font(pfc.Families[0], 16, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))));
  44. ////设置字体
  45. //this.speed.Font = f;
  46. }
  47. public bool kg
  48. {
  49. get
  50. {
  51. return b;
  52. }
  53. set
  54. {
  55. b = value;
  56. if (b)
  57. {
  58. this.title.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
  59. }
  60. else
  61. {
  62. this.title.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
  63. }
  64. }
  65. }
  66. public string fWindTurbineId
  67. {
  68. set;
  69. get;
  70. }
  71. public string WindTurbineId
  72. {
  73. set;
  74. get;
  75. }
  76. public string StatusId
  77. {
  78. set
  79. {
  80. if (this.tableLayoutPanel1.Tag == null)
  81. {
  82. this.tableLayoutPanel1.Tag = new MyKeyValue<string, int>(value, 0);
  83. }
  84. }
  85. get
  86. {
  87. return ((MyKeyValue<string, int>)this.tableLayoutPanel1.Tag).Key;
  88. }
  89. }
  90. public string SpeedId
  91. {
  92. set
  93. {
  94. if (this.speed.Tag == null)
  95. {
  96. this.speed.Tag = new MyKeyValue<string, double>(value, 0) ;
  97. }
  98. }
  99. get
  100. {
  101. return ((MyKeyValue<string, double>)this.speed.Tag).Key;
  102. }
  103. }
  104. public string PowerId
  105. {
  106. set
  107. {
  108. if (this.power.Tag == null)
  109. {
  110. this.power.Tag = new MyKeyValue<string, double>(value, 0);
  111. }
  112. }
  113. get
  114. {
  115. return ((MyKeyValue<string, double>)this.power.Tag).Key;
  116. }
  117. }
  118. public string WindTurbineName
  119. {
  120. set { this.title.Text = value; }
  121. get { return this.title.Text; }
  122. }
  123. double speedvalue;
  124. public double Speed
  125. {
  126. get
  127. {
  128. return ((MyKeyValue<string, double>)this.speed.Tag).Value; ;
  129. }
  130. }
  131. double powervalue;
  132. public double Power
  133. {
  134. get
  135. {
  136. return ((MyKeyValue<string, double>)this.power.Tag).Value;
  137. }
  138. }
  139. /// <summary>
  140. /// 0, "待机";1, "手动停机";2, "正常发电";3, "发电降出力";4, "限电降出力";5, "限电停机";6, "故障";
  141. /// 7, "故障受累";8, "检修";9, "检修受累";10, "电网受累";11, "环境受累";12, "离线";
  142. /// </summary>
  143. int statusvalue;
  144. public int Status
  145. {
  146. get
  147. {
  148. return ((MyKeyValue<string, int>)this.tableLayoutPanel1.Tag).Value;
  149. }
  150. }
  151. private void tableLayoutPanel1_MouseEnter(object sender, EventArgs e)
  152. {
  153. this.BackColor = Color.White;
  154. }
  155. private void tableLayoutPanel1_MouseLeave(object sender, EventArgs e)
  156. {
  157. this.BackColor = Color.Gray;
  158. }
  159. private void toolStripMenuItem3_Click(object sender, EventArgs e)
  160. {
  161. //this.title.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
  162. kg = false;
  163. }
  164. private void toolStripMenuItem2_Click(object sender, EventArgs e)
  165. {
  166. //this.panel2.Visible = true;
  167. //SelectWTForm form = new SelectWTForm(this);
  168. //form.ShowDialog();
  169. }
  170. public void Builder()
  171. {
  172. //LabelManger.AddLabel(this.speed);
  173. //LabelManger.AddLabel(this.power);
  174. //PanelMessage.AddPanel(this.tableLayoutPanel1);
  175. }
  176. public void Dop()
  177. {
  178. //LabelManger.DeleteLabel(this.speed);
  179. //LabelManger.DeleteLabel(this.power);
  180. //PanelMessage.DeletePanel(this.tableLayoutPanel1);
  181. }
  182. private void power_Click(object sender, EventArgs e)
  183. {
  184. }
  185. private void title_Click(object sender, EventArgs e)
  186. {
  187. }
  188. }
  189. }