You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lj_plc/Controls/Mesnac.Controls.ChemicalWei.../LSCREWBIG.cs

85 lines
2.0 KiB
C#

using System;
using System.Drawing;
using System.IO;
using System.Reflection;
using System.Windows.Forms;
namespace Mesnac.Controls.ChemicalWeighing
{
/// <summary>
/// 螺旋给料器左(小)
/// </summary>
[ToolboxBitmap(typeof(LSCREWBIG), "Resources.LSCREW_BIG01.png")] //新添加的代码
public partial class LSCREWBIG : ChemicalWeighingControl
{
private object _data = new object();
public enum Statuses
{
ylNormal = 0, ylMove = 1 //, ylAlarm = 2
}
Statuses _status;
string[] sImages;
public LSCREWBIG()
: base()
{
InitializeComponent();
Init();
ReloadStream();
}
protected sealed override void Init()
{
base.Init();
_imageStream = null;
sImages = new string[2];
sImages[0] = "Mesnac.Controls.ChemicalWeighing.Resources.LSCREW_BIG01.png";
sImages[1] = "Mesnac.Controls.ChemicalWeighing.Resources.LSCREW_BIGMOVE.gif";
_status = Statuses.ylNormal;
}
private void ReloadStream()
{
int nIndex = (int)_status;
_imageStream = _assembly.GetManifestResourceStream(sImages[nIndex]);
if (_imageStream != null)
{
Image img = Image.FromStream(_imageStream);
pictureBox1.Image = img;
pictureBox1.Refresh();
}
}
public Statuses Status
{
get => _status;
set
{
if (_status != value)
{
lock (_data)
{
_status = value;
ReloadStream();
}
}
}
}
private void PressureSwitch_Load(object sender, EventArgs e)
{
}
}
}