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.

98 lines
2.4 KiB
C#

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
{
/// <summary>
/// 条码物料列表
/// </summary>
[ToolboxBitmap(typeof(System.Windows.Forms.ListBox))]
public partial class BarcodeMaterialList : ListBox
{
public BarcodeMaterialList()
{
InitializeComponent();
InitMethod();
}
public BarcodeMaterialList(IContainer container)
{
container.Add(this);
InitializeComponent();
InitMethod();
}
/// <summary>
/// 初始化方法
/// </summary>
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;
/// <summary>
/// 是否有动画
/// </summary>
public bool bHaveAction
{
get { return _bHaveAction; }
set { _bHaveAction = value; }
}
/// <summary>
/// 数据源动画属性
/// </summary>
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
}
}