123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- 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);
- }
- }
- /// <summary>
- /// 获取焦点事件
- /// </summary>
- public void Style_Focus()
- {
- panel1.BackColor = Color.White;
- lblWindturbineName.ForeColor = Color.Black;
- }
- /// <summary>
- /// 失去焦点事件
- /// </summary>
- public void Style_UnFocus()
- {
- panel1.BackColor = Color.FromArgb(3, 24, 48);
- lblWindturbineName.ForeColor = Color.White;
- }
- }
- }
|