using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string list = "";
for (int i = (checkedListBox1.Items.Count - 1); i >= 0; i--)
{
if (checkedListBox1.GetItemChecked(i))
{
list = checkedListBox1.Items[i].ToString();
checkedListBox1.Items.Remove(checkedListBox1.Items[i]);
checkedListBox2.Items.Add(list);
}
}
}
private void button2_Click(object sender, EventArgs e)
{
string list = "";
for (int i = (checkedListBox2.Items.Count - 1); i >= 0; i--)
{
if (checkedListBox2.GetItemChecked(i))
{
list = checkedListBox2.Items[i].ToString();
checkedListBox2.Items.Remove(checkedListBox2.Items[i]);
checkedListBox1.Items.Add(list);
}
}
}
private void checkedListBox1_SelectedIndexChanged(object sender, EventArgs e)
{
checkedListBox1.CheckOnClick = true;
}
private void checkedListBox2_SelectedIndexChanged(object sender, EventArgs e)
{
checkedListBox2.CheckOnClick = true;
}
}
}
沒有留言:
張貼留言