标签:ar os sp for div bs ad ef as
//左到右
private void btnLeftToRight_Click(object sender, EventArgs e)
{
if (listBox1.SelectedItems != null)
{
foreach (var item in listBox1.SelectedItems)
{
listBox2.Items.Add(item.ToString());
}
for (int i = 0; i < listBox1.SelectedIndices.Count; i++)
{
listBox1.Items.RemoveAt(listBox1.SelectedIndices[i]);
i--;
}
}
}
//右到左
private void btnRightToLeft_Click(object sender, EventArgs e)
{
if (listBox2.SelectedItems != null)
{
foreach (var item in listBox2.SelectedItems)
{
listBox1.Items.Add(item.ToString());
}
for (int i = 0; i < listBox2.SelectedIndices.Count; i++)
{
listBox2.Items.RemoveAt(listBox2.SelectedIndices[i]);
i--;
}
}
}
foreach (var item in listBox1.SelectedItems)
{
listBox2.Items.Add(item.ToString());
}
for (int i = 0; i < listBox1.SelectedIndices.Count; i++)
{
listBox1.Items.RemoveAt(listBox1.SelectedIndices[i]);
i--;
}
标签:ar os sp for div bs ad ef as
原文地址:http://www.cnblogs.com/ZhangYuLIng/p/4153572.html