123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Text.RegularExpressions;
- using System.Threading;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using EntityDataSet;
- using IntelligentControlForsx.Code;
- using IntelligentControlForsx.MyControls.agc;
- using IntelligentControlForsx.Service.Control.FormInfo;
- using IntelligentControlForsx.Service.WindturbineControl.Domain;
- using IntelligentControlForsx.Service.WindturbineControl.Domain.Cmd;
- using IntelligentControlForsx.Service.WindturbineControl.Domain.FormInfo;
- using IntelligentControlForsx.Service.WindturbineControl.FormInfoSvc;
- using IntelligentControlForsx.Service.WindturbineControl.IntPtrSvc;
- using IntelligentControlForsx.Template;
- using Gyee_Control.Svc.Cache;
- using Gyee_Control.View;
- using log4net;
- using log4net.Util;
- namespace IntelligentControlForsx.ChildForms
- {
- public partial class AGCForm : TemplateForm
- {
- /// <summary>
- /// 鼠标悬停取得图片路径
- /// </summary>
- Dictionary<string, string> mouseEnterDic = new Dictionary<string, string>();
- /// <summary>
- /// 鼠标离开取得图片路径
- /// </summary>
- Dictionary<string, string> mouseLeaveDic = new Dictionary<string, string>();
- PictureBox defaultPicture;
- [Browsable(true), Category("Appearance")]
- public PictureBox DefaultPicture
- {
- get
- {
- return defaultPicture;
- }
- set
- {
- if (!this.DesignMode)
- {
- value.Image = Image.FromFile(mouseEnterDic[value.Name]);
- value.Cursor = System.Windows.Forms.Cursors.Default;
- defaultPicture.Image = Image.FromFile(mouseLeaveDic[defaultPicture.Name]);
- defaultPicture.Cursor = System.Windows.Forms.Cursors.Hand;
- }
- defaultPicture = value;
- }
- }
- string path = UserTools.Path;
- public AGCForm()
- {
- InitializeComponent();
- if (!this.DesignMode)
- {
- string wind1 = path + @"\images\wind_02.png";
- string sun1 = path + @"\images\sun_02.png";
- string wind2 = path + @"\images\wind_01.png";
- string sun2 = path + @"\images\sun_01.png";
- mouseEnterDic.Add(this.picWindturbine.Name, wind1);
- mouseEnterDic.Add(this.picSun.Name, sun1);
- mouseLeaveDic.Add(this.picWindturbine.Name, wind2);
- mouseLeaveDic.Add(this.picSun.Name, sun2);
- defaultPicture = this.picWindturbine;
- picWindturbine.Image = Image.FromFile(mouseEnterDic[picWindturbine.Name]);
- sunAGC.Hide();
- }
- }
- public override void Active()
- {
- this.Show();
- timer1.Enabled = true;
- this.windAGC.Show();
- this.sunAGC.Hide();
- this.windAGC.Active();
- this.windAGC.Active();
- DefaultPicture = this.picWindturbine;
- }
- public override void DeActive()
- {
- this.Hide();
- timer1.Enabled = false;
- this.windAGC.DeActive();
- this.sunAGC.DeActive();
- }
- private void picBox_MouseEnter(object sender, EventArgs e)
- {
- if (!this.DesignMode)
- {
- PictureBox box = (PictureBox)sender;
- if (defaultPicture.Name != box.Name)
- {
- box.Image = Image.FromFile(mouseEnterDic[box.Name]);
- }
- }
- }
- private void picBox_MouseLeave(object sender, EventArgs e)
- {
- if (!this.DesignMode)
- {
- if (!this.DesignMode)
- {
- PictureBox box = (PictureBox)sender;
- if (defaultPicture.Name != box.Name)
- {
- box.Image = Image.FromFile(mouseLeaveDic[box.Name]);
- }
- }
- }
- }
- private void picBox_Click(object sender, EventArgs e)
- {
- if (!this.DesignMode)
- {
- PictureBox box = (PictureBox)sender;
- if (defaultPicture.Name != box.Name)
- {
- DefaultPicture = box;
- }
- if (box.Name == "picWindturbine")
- {
- lblTitle.Text = "风电场AGC总览";
- windAGC.Show();
- windAGC.Active();
- sunAGC.Hide();
- sunAGC.DeActive();
- }
- else
- {
- lblTitle.Text = "光伏电站AGC/AVC总览";
- windAGC.Hide();
- windAGC.DeActive();
- sunAGC.Show();
- sunAGC.Active();
- }
- }
- }
- }
- }
|