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; namespace IntelligentControlForsx.MyControls.zm.map { public partial class WindturbineInfoControl : UserControl { public WindturbineInfoControl() { InitializeComponent(); SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); // 禁止擦除背景.   SetStyle(ControlStyles.DoubleBuffer, true); // 双缓冲   this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); this.UpdateStyles(); wpfWindturbine1.MyClick += WPF_Click; } private string windturbineName; public string WindturbineName { set { lblWindturbineId.Text = value; windturbineName = value; } get { return windturbineName; } } private string windturbineId = ""; [Category("Xproperty"), Description("风机编号,格式符合将自动设置WindturbineName")] public string WindturbineId { get { return windturbineId; } set { windturbineId = value; if (windturbineId.IndexOf("_") > 0 && windturbineId.IndexOf("_") < windturbineId.Length) { string tmp = windturbineId.Substring(windturbineId.IndexOf("_") + 1); WindturbineName = tmp + "号"; } } } private double power; public double Power { set { lblPower.Text = value.ToString("f2") + "kw"; power = value; } get { return power; } } private double windSpeed; public double WindSpeed { set { lblWindSpeed.Text = value.ToString("f2") + "m/s"; windSpeed = value; } get { return windSpeed; } } private int status; public int Status { set { status = value; wpfWindturbine1.WState = value; } get { return status; } } public void BindData(double power, double windSpeed, int status) { Power = power; WindSpeed = windSpeed; Status = status; } public event EventHandler MyClick; void WPF_Click(object sender, EventArgs e) { MyClick(this, e); } } }