using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using IntelligentControlForsx.Service.WindturbineControl.Domain; namespace IntelligentControlForsx.MyControls.windturbine { public partial class LabelWindturbineName : UserControl { public LabelWindturbineName() { InitializeComponent(); } private string windturbineName; public string WindturbineName { set { windturbineName = value; lblWindturbineName.Text = value; lblWindturbineName.Name = value; } get { return windturbineName; } } private WindturbineStatus status; public WindturbineStatus Status { set { status = value; switch (value) { case WindturbineStatus.Offline: lblStatus.BackColor = Color.FromArgb(134, 150, 165); break; case WindturbineStatus.Start: lblStatus.BackColor = Color.FromArgb(14, 72, 91); break; case WindturbineStatus.Fault: lblStatus.BackColor = Color.FromArgb(170, 15, 59); break; case WindturbineStatus.Maintain: lblStatus.BackColor = Color.FromArgb(204, 83, 51); break; case WindturbineStatus.Stop: lblStatus.BackColor = Color.FromArgb(176, 151, 63); break; case WindturbineStatus.Online: lblStatus.BackColor = Color.FromArgb(15, 135, 170); break; case WindturbineStatus.OnPower: lblStatus.BackColor = Color.FromArgb(177, 14, 126); break; case WindturbineStatus.Standby: lblStatus.BackColor = Color.FromArgb(15, 141, 106); break; default: break; } } get { return status; } } public event EventHandler MyClick; private void lblWindturbineName_Click(object sender, EventArgs e) { if (!this.DesignMode) { Label lable = (Label)sender; MyClick(this, e); } } /// /// 获取焦点事件 /// public void Style_Focus() { panel1.BackColor = Color.White; lblWindturbineName.ForeColor = Color.Black; } /// /// 失去焦点事件 /// public void Style_UnFocus() { panel1.BackColor = Color.FromArgb(3, 24, 48); lblWindturbineName.ForeColor = Color.White; } } }