public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//按钮事件,点击按钮将Motor内的值遍历显示到listBox控件中
private void button1_Click(object sender, EventArgs e)
{
Motor motor = Motor.ACSC_MST_ENABLE;
foreach (Motor item in Enum.GetValues(typeof(Motor)))
{
listBox1.Items.Add((int)item + ":" + item);
}
}
}
public enum Motor
{
ACSC_ALL = -1,
ACSC_NONE = 0,
ACSC_MST_ENABLE = 1,
ACSC_MST_INPOS = 16,
ACSC_MST_MOVE = 32,
ACSC_MST_ACC = 64
}