winform CheckListBox

for (int i = 0; i < set.listHaoYouForZengSong.Count; i++)
{
KeyValuePair kv = new KeyValuePair(set.listHaoYouForZengSong[i].playerID, set.listHaoYouForZengSong[i].name);
clbHaoYouForZengSong.Items.Add(kv, set.listHaoYouForZengSong[i].selected);
}


List tmplistHaoYouForZengSong = new List();
for (int i = 0; i < clbHaoYouForZengSong.Items.Count; i++)
{
tmplistHaoYouForZengSong.Add(new HaoYouSet() { playerID = ((KeyValuePair)clbHaoYouForZengSong.Items[i]).Key,
name = ((KeyValuePair)clbHaoYouForZengSong.Items[i]).Value,
selected = clbHaoYouForZengSong.CheckedIndices.Contains(i)
});
}

你可能感兴趣的:(winform CheckListBox)