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 { /// /// 鼠标悬停取得图片路径 /// Dictionary mouseEnterDic = new Dictionary(); /// /// 鼠标离开取得图片路径 /// Dictionary mouseLeaveDic = new Dictionary(); 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(); } } } } }