using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; namespace Mesnac.Controls.Feeding { /// /// 条码物料列表 /// [ToolboxBitmap(typeof(System.Windows.Forms.ListBox))] public partial class BarcodeMaterialList : ListBox { public BarcodeMaterialList() { InitializeComponent(); InitMethod(); } public BarcodeMaterialList(IContainer container) { container.Add(this); InitializeComponent(); InitMethod(); } /// /// 初始化方法 /// private void InitMethod() { this.AllowDrop = false; this.Sorted = false; this.SelectionMode = SelectionMode.None; } #region 自定义属性 private string _dataName; private bool _bHaveAction; private string _data; private string _cloneData; string tmpdata = string.Empty; /// /// 是否有动画 /// public bool bHaveAction { get { return _bHaveAction; } set { _bHaveAction = value; } } /// /// 数据源动画属性 /// public string DataName { get { return _dataName; } set { _dataName = value; } } public string Data { get { return _data; } set { if (_data != value) { _data = value; ResolveDataToList(); } } } private void ResolveDataToList() { if (this._data != null) { string dataString = this._data; if (tmpdata != dataString) { tmpdata = dataString; string[] array = dataString.Split(new char[] { '|' }); this.Items.Clear(); for (int i = 0; i < array.Count(); i++) { this.Items.Add(array[i]); } } } } #endregion } }