//--上移动作
//-------------------------------------------------------
private void Up()
{
if (ListBox1.SelectedIndex >0)
{
string t;
string s;
int index;
index=ListBox1.SelectedIndex;
t=ListBox1.SelectedItem.Text ;
s=ListBox1.SelectedItem.Value ;
ListBox1.SelectedItem.Text =ListBox1.Items[index-1].Text ;
ListBox1.SelectedItem.Value =ListBox1.Items[index-1].Value ;
ListBox1.Items[index-1].Text =t;
ListBox1.Items[index-1].Value =s;
ListBox1.SelectedIndex --;
}
}
//-------------------------------------------------------
//--下移动作
//-------------------------------------------------------
private void Down()
{
if (ListBox1.SelectedIndex <ListBox1.Items.Count-1 )
{
string t;
string s;
int index;
index=ListBox1.SelectedIndex;
t=ListBox1.SelectedItem.Text ;
s=ListBox1.SelectedItem.Value ;
ListBox1.SelectedItem.Text =ListBox1.Items[index+1].Text ;
ListBox1.SelectedItem.Value =ListBox1.Items[index+1].Value ;
ListBox1.Items[index+1].Text =t;
ListBox1.Items[index+1].Value =s;
ListBox1.SelectedIndex ++;
}
}
//-------------------------------------------------------
//--右移动作
//-------------------------------------------------------
private void MoveRight()
{
if (ListBox1.Items.Count>0 )
{
int i,index;
int count;
index=0;
count=ListBox1.Items.Count;
for (i=0;i<count;i++)
{
ListItem Item=ListBox1.Items[index];
if (ListBox1.Items[index].Selected ==true)
{
ListBox1.Items.Remove(Item);
ListBox2.Items.Add (Item);
index--;
}
index++;
}
}
}