LSCREWBIG

wangsr
我叫锄头 1 year ago
parent 2d2adbedf7
commit 18e0614a3d

@ -55,6 +55,7 @@ namespace Mesnac.Action.ChemicalWeighing.Test
liss = db2105Helper.ReadReadyM8; liss = db2105Helper.ReadReadyM8;
var yw= Db3000Helper.ReadModel(); var yw= Db3000Helper.ReadModel();
} }

@ -9,23 +9,11 @@ namespace Mesnac.Controls.ChemicalWeighing
/// <summary> /// <summary>
/// 螺旋给料器左(小) /// 螺旋给料器左(小)
/// </summary> /// </summary>
[ToolboxBitmap(typeof(LSCREWBIG), "Resources.LSCREW_BIG01.png")]//新添加的代码 [ToolboxBitmap(typeof(LSCREWBIG), "Resources.LSCREW_BIG01.png")] //新添加的代码
public partial class LSCREWBIG : ChemicalWeighingControl public partial class LSCREWBIG : ChemicalWeighingControl
{ {
bool bNewPic = false; private object _data = new object();
string _statusName;
public string StatusName
{
get
{
return _statusName;
}
set
{
_statusName = value;
}
}
public enum Statuses public enum Statuses
{ {
ylNormal = 0, ylMove = 1 //, ylAlarm = 2 ylNormal = 0, ylMove = 1 //, ylAlarm = 2
@ -38,101 +26,59 @@ namespace Mesnac.Controls.ChemicalWeighing
InitializeComponent(); InitializeComponent();
Init(); Init();
ReloadStream(); ReloadStream();
} }
protected override void Init() protected sealed override void Init()
{ {
base.Init(); base.Init();
_imageStream = null; _imageStream = null;
sImages = new string[3]; sImages = new string[2];
sImages[0] = "Mesnac.Controls.ChemicalWeighing.Resources.LSCREW_BIG01.png"; sImages[0] = "Mesnac.Controls.ChemicalWeighing.Resources.LSCREW_BIG01.png";
sImages[1] = "Mesnac.Controls.ChemicalWeighing.Resources.LSCREW_BIGMOVE.gif"; sImages[1] = "Mesnac.Controls.ChemicalWeighing.Resources.LSCREW_BIGMOVE.gif";
_status = Statuses.ylNormal; _status = Statuses.ylNormal;
} }
private void ReloadStream() private void ReloadStream()
{ {
//CloseStream();
int nIndex = (int)_status; int nIndex = (int)_status;
_imageStream = _assembly.GetManifestResourceStream(sImages[nIndex]); _imageStream = _assembly.GetManifestResourceStream(sImages[nIndex]);
if (_imageStream != null)
{
Image img = Image.FromStream(_imageStream);
pictureBox1.Image = img;
pictureBox1.Refresh();
}
} }
public Statuses Status public Statuses Status
{ {
get get => _status;
{
return _status;
}
set set
{ {
if (bFirstCreated == true)
{
bFirstCreated = false;
}
if (_status != value) if (_status != value)
{ {
if (this.DesignMode == true) lock (_data)
{ {
bNewPic = true; _status = value;
ReloadStream();
} }
} }
if ((int)value <= 0)
{
_status = (Statuses)0;
}
else if ((int)value >= 1)
{
_status = (Statuses)1;
}
else
{
_status = value;
}
ReloadStream();
Reload();
}
}
private void Reload()
{
if ( _imageStream != null )
{
Image img = Image.FromStream( _imageStream );
if ( bNewPic == true )
{
//this.Size = img.Size;
bNewPic = false;
}
pictureBox1.Image = img;
pictureBox1.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 PressureSwitch_Load(object sender, EventArgs e) private void PressureSwitch_Load(object sender, EventArgs e)
{ {
if (bFirstCreated == true && this.DesignMode == true)
{
bNewPic = true;
bFirstCreated = false;
Reload();
}
} }
} }
} }

@ -7,9 +7,9 @@ using System.Windows.Forms;
namespace Mesnac.Controls.ChemicalWeighing namespace Mesnac.Controls.ChemicalWeighing
{ {
/// <summary> /// <summary>
/// 震动给料器右(大) /// 震动给料器右(大)
/// </summary> /// </summary>
[ToolboxBitmap(typeof(RSCREWBIG), "Resources.RSCREW_BIGA.png")]//新添加的代码 [ToolboxBitmap(typeof(RSCREWBIG), "Resources.RSCREW_BIGA.png")]//新添加的代码
public partial class RSCREWBIG : ChemicalWeighingControl public partial class RSCREWBIG : ChemicalWeighingControl
{ {
@ -30,7 +30,7 @@ namespace Mesnac.Controls.ChemicalWeighing
} }
protected override void Init() protected sealed override void Init()
{ {
base.Init(); base.Init();
_imageStream = null; _imageStream = null;
@ -57,10 +57,7 @@ namespace Mesnac.Controls.ChemicalWeighing
public Statuses Status public Statuses Status
{ {
get get => _status;
{
return _status;
}
set set
{ {

Loading…
Cancel
Save