12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- 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 WisdomClient.data;
- namespace IntelligentControlForsx.MyControls
- {
- public partial class WindturbineIcon : UserControl
- {
- private string windturbineId;
- public WindturbineIcon()
- {
- InitializeComponent();
- SetStyle(ControlStyles.UserPaint, true);
- SetStyle(ControlStyles.AllPaintingInWmPaint, true);
- SetStyle(ControlStyles.DoubleBuffer, true); // 双缓冲
- this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
- this.UpdateStyles();
- wpfWindturbine1.MyClick += WPF_Click;
- }
- [Browsable(true), Category("DATA")]
- public string WindturbineId
- {
- get
- {
- return windturbineId;
- }
- set
- {
- windturbineId = value;
- UpdateLblTitle(windturbineId);
- }
- }
- private void UpdateLblTitle(String windturbineId)
- {
- if (String.IsNullOrWhiteSpace(windturbineId))
- return;
- String[] arr = windturbineId.Split('_');
- if (arr != null && arr.Length == 2)
- {
- int num = 0;
- if (int.TryParse(arr[1], out num))
- {
- label1.Text = num.ToString();
- }
- }
- }
- public int Status
- {
- get
- {
- return this.wpfWindturbine1.WState;
- }
- set
- {
- this.wpfWindturbine1.WState = value;
- }
- }
- public event EventHandler MyClick;
- void WPF_Click(object sender, EventArgs e)
- {
- MyClick(this, e);
- }
- }
- }
|