|
|
|
|
using System;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace Mesnac.Controls.Feeding
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 卸料门
|
|
|
|
|
/// </summary>
|
|
|
|
|
[ToolboxBitmap(typeof(DischargeDoor), "Resources.BagOpenStation.bmp")]//新添加的代码
|
|
|
|
|
public partial class DischargeDoor : FeedingControl
|
|
|
|
|
{
|
|
|
|
|
bool bNewPic = false;
|
|
|
|
|
string _statusName;
|
|
|
|
|
|
|
|
|
|
public string StatusName
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return _statusName;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_statusName = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public enum Statuses
|
|
|
|
|
{
|
|
|
|
|
xlmnormal = 0, xlmOpen = 1, xlmClose = 2, xlmAlarm = 3
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Statuses _status;
|
|
|
|
|
string[] sImages;
|
|
|
|
|
public DischargeDoor():base()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
|
|
Init();
|
|
|
|
|
|
|
|
|
|
ReloadStream();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void Init()
|
|
|
|
|
{
|
|
|
|
|
base.Init();
|
|
|
|
|
_imageStream = null;
|
|
|
|
|
|
|
|
|
|
sImages = new string[4];
|
|
|
|
|
sImages[0] = "Mesnac.Controls.Feeding.Resources.xlm.xlmNormal.gif";//dkNull
|
|
|
|
|
sImages[1] = "Mesnac.Controls.Feeding.Resources.xlm.xlmOpen.gif";//dkFull
|
|
|
|
|
sImages[2] = "Mesnac.Controls.Feeding.Resources.xlm.xlmClose.gif";//dkMove
|
|
|
|
|
sImages[3] = "Mesnac.Controls.Feeding.Resources.xlm.xlmAlarm.gif";//dkMove
|
|
|
|
|
|
|
|
|
|
_status = Statuses.xlmnormal;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ReloadStream()
|
|
|
|
|
{
|
|
|
|
|
//CloseStream();
|
|
|
|
|
int nIndex = (int)_status;
|
|
|
|
|
_imageStream = _assembly.GetManifestResourceStream(sImages[nIndex]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Statuses Status
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return _status;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (bFirstCreated == true)
|
|
|
|
|
{
|
|
|
|
|
bFirstCreated = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool flag = false;
|
|
|
|
|
//if (_status != value &&(this.Size.Width != 150 || this.Size.Height != 150) )
|
|
|
|
|
if ( _status != value )
|
|
|
|
|
{
|
|
|
|
|
flag = true;
|
|
|
|
|
if (this.DesignMode == true)
|
|
|
|
|
{
|
|
|
|
|
bNewPic = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( (int)value < 0 )
|
|
|
|
|
{
|
|
|
|
|
_status = (Statuses)0;
|
|
|
|
|
}
|
|
|
|
|
else if ( (int)value > 3 )
|
|
|
|
|
{
|
|
|
|
|
_status = (Statuses)3;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_status = value;
|
|
|
|
|
}
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
ReloadStream();
|
|
|
|
|
this.Refresh();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
protected override void OnPaint(PaintEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (_imageStream != null)
|
|
|
|
|
{
|
|
|
|
|
Graphics g = e.Graphics;
|
|
|
|
|
Image img = Image.FromStream(_imageStream);
|
|
|
|
|
if (bNewPic == true)
|
|
|
|
|
{
|
|
|
|
|
this.Size = img.Size;
|
|
|
|
|
bNewPic = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g.DrawImage(img, 0, 0, this.Width, this.Height);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void DischargeDoor_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (bFirstCreated == true && this.DesignMode == true)
|
|
|
|
|
{
|
|
|
|
|
bNewPic = true;
|
|
|
|
|
bFirstCreated = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|