123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- 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.Code;
- namespace IntelligentControlForsx.MyControls
- {
- public partial class Photovoltaic : UserControl
- {
- public Photovoltaic()
- {
- InitializeComponent();
- }
- private int state;
- public int State
- {
- get { return state; }
- set
- {
- if (!this.DesignMode)
- {
- state = value;
- string path = UserTools.Path;
- string str = path + @"\images\图标光伏-待机.png";
- switch (value)
- {
- case 0:
- str = path + @"\images\图标光伏-待机.png";
- break;
- case 1:
- str = path + @"\images\图标光伏-运行.png";
- break;
- case 2:
- str = path + @"\images\图标光伏-故障.png";
- break;
- case 3:
- str = path + @"\images\图标光伏-离线.png";
- break;
- case 4:
- str = path + @"\images\图标光伏-维护.png";
- break;
- case 5:
- str = path + @"\images\图标光伏-限电.png";
- break;
- case 6:
- str = path + @"\images\图标光伏-限电.png";
- break;
- default:
- str = path + @"\images\图标光伏-待机.png";
- break;
- }
- this.BackgroundImage = Image.FromFile(str);
- }
- }
- }
- private void Photovoltaic_MouseEnter(object sender, EventArgs e)
- {
- if (!this.DesignMode)
- {
- string path = UserTools.Path;
- string str = path + @"\images\图标光伏-待机1.png";
- switch (state)
- {
- case 0:
- str = path + @"\images\图标光伏-待机1.png";
- break;
- case 1:
- str = path + @"\images\图标光伏-运行1.png";
- break;
- case 2:
- str = path + @"\images\图标光伏-故障1.png";
- break;
- case 3:
- str = path + @"\images\图标光伏-离线1.png";
- break;
- case 4:
- str = path + @"\images\图标光伏-维护1.png";
- break;
- case 5:
- str = path + @"\images\图标光伏-限电1.png";
- break;
- case 6:
- str = path + @"\images\图标光伏-限电1.png";
- break;
- default:
- str = path + @"\images\图标光伏-待机1.png";
- break;
- }
- this.BackgroundImage = Image.FromFile(str);
- }
- }
- private void Photovoltaic_MouseLeave(object sender, EventArgs e)
- {
- if (!this.DesignMode)
- {
- string path = UserTools.Path;
- string str = path + @"\images\图标光伏-待机.png";
- switch (state)
- {
- case 0:
- str = path + @"\images\图标光伏-待机.png";
- break;
- case 1:
- str = path + @"\images\图标光伏-运行.png";
- break;
- case 2:
- str = path + @"\images\图标光伏-故障.png";
- break;
- case 3:
- str = path + @"\images\图标光伏-离线.png";
- break;
- case 4:
- str = path + @"\images\图标光伏-维护.png";
- break;
- case 5:
- str = path + @"\images\图标光伏-限电.png";
- break;
- case 6:
- str = path + @"\images\图标光伏-限电.png";
- break;
- default:
- str = path + @"\images\图标光伏-待机.png";
- break;
- }
- this.BackgroundImage = Image.FromFile(str);
- }
- }
- public event EventHandler MyClick;
- private void Photovoltaic_Click(object sender, EventArgs e)
- {
- if (MyClick != null)
- {
- MyClick(this, e);
- }
- MessageBox.Show(state.ToString());
- }
-
- }
- }
|