using System; using System.Drawing; using System.IO; using System.Reflection; using System.Windows.Forms; namespace Mesnac.Controls.ChemicalWeighing { /// /// 震动给料器右(大) /// [ToolboxBitmap(typeof(RSCREWBIG), "Resources.RSCREW_BIGA.png")]//新添加的代码 public partial class RSCREWBIG : ChemicalWeighingControl { private object _data = new object(); public enum Statuses { ylNormal = 0, ylMove = 1 //, ylAlarm = 2 } Statuses _status; string[] sImages; public RSCREWBIG() : base() { InitializeComponent(); Init(); ReloadStream(); } protected override void Init() { base.Init(); _imageStream = null; sImages = new string[2]; sImages[0] = "Mesnac.Controls.ChemicalWeighing.Resources.RSCREW_BIGA.png"; sImages[1] = "Mesnac.Controls.ChemicalWeighing.Resources.RSCREW_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 { return _status; } set { if (_status != value) { lock (_data) { _status = value; ReloadStream(); } } } } private void PressureSwitch_Load(object sender, EventArgs e) { } } }