private void btnUp_Click(object sender, EventArgs e)
{
this.checkedListBoxAttribute.ItemCheck -= checkedListBoxAttribute_ItemCheck;
this.checkedListBoxAttribute.SelectedIndexChanged -= checkedListBoxAttribute_SelectedIndexChanged;
string item = checkedListBoxAttribute.SelectedItem.ToString();
int selectIndex = checkedListBoxAttribute.SelectedIndex;
bool state = checkedListBoxAttribute.GetItemChecked(selectIndex);
checkedListBoxAttribute.Items.RemoveAt(checkedListBoxAttribute.SelectedIndex);
checkedListBoxAttribute.Items.Insert(selectIndex - 1, item);
checkedListBoxAttribute.SetItemChecked(selectIndex - 1, state);
this.checkedListBoxAttribute.ItemCheck +=checkedListBoxAttribute_ItemCheck;
this.checkedListBoxAttribute.SelectedIndexChanged+=checkedListBoxAttribute_SelectedIndexChanged;
checkedListBoxAttribute.SelectedIndex = selectIndex - 1;
}
private void btnDown_Click(object sender, EventArgs e)
{
this.checkedListBoxAttribute.ItemCheck -= checkedListBoxAttribute_ItemCheck;
this.checkedListBoxAttribute.SelectedIndexChanged -= checkedListBoxAttribute_SelectedIndexChanged;
string item = checkedListBoxAttribute.SelectedItem.ToString();
int selectIndex = checkedListBoxAttribute.SelectedIndex;
bool state = checkedListBoxAttribute.GetItemChecked(selectIndex);
checkedListBoxAttribute.Items.RemoveAt(checkedListBoxAttribute.SelectedIndex);
checkedListBoxAttribute.Items.Insert(selectIndex + 1, item);
checkedListBoxAttribute.SetItemChecked(selectIndex + 1, state);
this.checkedListBoxAttribute.ItemCheck += checkedListBoxAttribute_ItemCheck;
this.checkedListBoxAttribute.SelectedIndexChanged += checkedListBoxAttribute_SelectedIndexChanged;
checkedListBoxAttribute.SelectedIndex = selectIndex + 1;
}