AGCForm.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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.Text.RegularExpressions;
  9. using System.Threading;
  10. using System.Threading.Tasks;
  11. using System.Windows.Forms;
  12. using EntityDataSet;
  13. using IntelligentControlForsx.Code;
  14. using IntelligentControlForsx.MyControls.agc;
  15. using IntelligentControlForsx.Service.Control.FormInfo;
  16. using IntelligentControlForsx.Service.WindturbineControl.Domain;
  17. using IntelligentControlForsx.Service.WindturbineControl.Domain.Cmd;
  18. using IntelligentControlForsx.Service.WindturbineControl.Domain.FormInfo;
  19. using IntelligentControlForsx.Service.WindturbineControl.FormInfoSvc;
  20. using IntelligentControlForsx.Service.WindturbineControl.IntPtrSvc;
  21. using IntelligentControlForsx.Template;
  22. using Gyee_Control.Svc.Cache;
  23. using Gyee_Control.View;
  24. using log4net;
  25. using log4net.Util;
  26. namespace IntelligentControlForsx.ChildForms
  27. {
  28. public partial class AGCForm : TemplateForm
  29. {
  30. /// <summary>
  31. /// 鼠标悬停取得图片路径
  32. /// </summary>
  33. Dictionary<string, string> mouseEnterDic = new Dictionary<string, string>();
  34. /// <summary>
  35. /// 鼠标离开取得图片路径
  36. /// </summary>
  37. Dictionary<string, string> mouseLeaveDic = new Dictionary<string, string>();
  38. PictureBox defaultPicture;
  39. [Browsable(true), Category("Appearance")]
  40. public PictureBox DefaultPicture
  41. {
  42. get
  43. {
  44. return defaultPicture;
  45. }
  46. set
  47. {
  48. if (!this.DesignMode)
  49. {
  50. value.Image = Image.FromFile(mouseEnterDic[value.Name]);
  51. value.Cursor = System.Windows.Forms.Cursors.Default;
  52. defaultPicture.Image = Image.FromFile(mouseLeaveDic[defaultPicture.Name]);
  53. defaultPicture.Cursor = System.Windows.Forms.Cursors.Hand;
  54. }
  55. defaultPicture = value;
  56. }
  57. }
  58. string path = UserTools.Path;
  59. public AGCForm()
  60. {
  61. InitializeComponent();
  62. if (!this.DesignMode)
  63. {
  64. string wind1 = path + @"\images\wind_02.png";
  65. string sun1 = path + @"\images\sun_02.png";
  66. string wind2 = path + @"\images\wind_01.png";
  67. string sun2 = path + @"\images\sun_01.png";
  68. mouseEnterDic.Add(this.picWindturbine.Name, wind1);
  69. mouseEnterDic.Add(this.picSun.Name, sun1);
  70. mouseLeaveDic.Add(this.picWindturbine.Name, wind2);
  71. mouseLeaveDic.Add(this.picSun.Name, sun2);
  72. defaultPicture = this.picWindturbine;
  73. picWindturbine.Image = Image.FromFile(mouseEnterDic[picWindturbine.Name]);
  74. sunAGC.Hide();
  75. }
  76. }
  77. public override void Active()
  78. {
  79. this.Show();
  80. timer1.Enabled = true;
  81. this.windAGC.Show();
  82. this.sunAGC.Hide();
  83. this.windAGC.Active();
  84. this.windAGC.Active();
  85. DefaultPicture = this.picWindturbine;
  86. }
  87. public override void DeActive()
  88. {
  89. this.Hide();
  90. timer1.Enabled = false;
  91. this.windAGC.DeActive();
  92. this.sunAGC.DeActive();
  93. }
  94. private void picBox_MouseEnter(object sender, EventArgs e)
  95. {
  96. if (!this.DesignMode)
  97. {
  98. PictureBox box = (PictureBox)sender;
  99. if (defaultPicture.Name != box.Name)
  100. {
  101. box.Image = Image.FromFile(mouseEnterDic[box.Name]);
  102. }
  103. }
  104. }
  105. private void picBox_MouseLeave(object sender, EventArgs e)
  106. {
  107. if (!this.DesignMode)
  108. {
  109. if (!this.DesignMode)
  110. {
  111. PictureBox box = (PictureBox)sender;
  112. if (defaultPicture.Name != box.Name)
  113. {
  114. box.Image = Image.FromFile(mouseLeaveDic[box.Name]);
  115. }
  116. }
  117. }
  118. }
  119. private void picBox_Click(object sender, EventArgs e)
  120. {
  121. if (!this.DesignMode)
  122. {
  123. PictureBox box = (PictureBox)sender;
  124. if (defaultPicture.Name != box.Name)
  125. {
  126. DefaultPicture = box;
  127. }
  128. if (box.Name == "picWindturbine")
  129. {
  130. lblTitle.Text = "风电场AGC总览";
  131. windAGC.Show();
  132. windAGC.Active();
  133. sunAGC.Hide();
  134. sunAGC.DeActive();
  135. }
  136. else
  137. {
  138. lblTitle.Text = "光伏电站AGC/AVC总览";
  139. windAGC.Hide();
  140. windAGC.DeActive();
  141. sunAGC.Show();
  142. sunAGC.Active();
  143. }
  144. }
  145. }
  146. }
  147. }