//上移节点
private void btnUP_Click(object sender, EventArgs e)
{
int lbxLength = this.listBoxMenu.Items.Count;//listbox的长度
int iselect = this.listBoxMenu.SelectedIndex;//listbox选择的索引
if (lbxLength > iselect && iselect>0)
{
object oTempItem = this.listBoxMenu.SelectedItem;
this.listBoxMenu.Items.RemoveAt(iselect);
this.listBoxMenu.Items.Insert(iselect - 1, oTempItem);
this.listBoxMenu.SelectedIndex = iselect - 1;
}
}
//下移节点
private void btnDown_Click(object sender, EventArgs e)
{
int lbxLength = this.listBoxMenu.Items.Count;//listbox的长度
int iselect = this.listBoxMenu.SelectedIndex;//listbox选择的索引
if (lbxLength > iselect && iselect<lbxLength-1)
{
object oTempItem = this.listBoxMenu.SelectedItem;
this.listBoxMenu.Items.RemoveAt(iselect);
this.listBoxMenu.Items.Insert(iselect + 1, oTempItem);
this.listBoxMenu.SelectedIndex = iselect + 1;
}
}