private void buttonDel_Click(object sender, EventArgs e) { if (listBoxSelProps.Items.Count == 0) { MessageBoxUtil.Exclamation("右边列表为空,无法选择属性!"); return; } if (listBoxSelProps.SelectedItems.Count == 0) { MessageBoxUtil.Exclamation("请选择右边的属性!"); return; } var startIndex = listBoxSelProps.SelectedIndices[0] - 1; if (startIndex == -1) { startIndex = 0; } var items = Utility.RemoveSelectedItems(listBoxSelProps); Utility.AddSelectedItems(listBoxProps, items); if (listBoxSelProps.Items.Count > 0) { listBoxSelProps.SelectedIndex = startIndex; } }
private void buttonOK_Click(object sender, EventArgs e) { var err = CheckPropValid(); if (!String.IsNullOrEmpty(err)) { MessageBoxUtil.Error(err); return; } DialogResult = DialogResult.OK; }
private void buttonDown_Click(object sender, EventArgs e) { if (listBoxSelProps.Items.Count == 0) { MessageBoxUtil.Exclamation("右边列表为空,无法选择属性!"); return; } if (listBoxSelProps.SelectedItems.Count == 0) { MessageBoxUtil.Exclamation("请选择右边的属性!"); return; } var err = Utility.MoveDown(listBoxSelProps); if (!String.IsNullOrEmpty(err)) { MessageBoxUtil.Exclamation(err); } }
private void buttonAdd_Click(object sender, EventArgs e) { if (listBoxProps.Items.Count == 0) { MessageBoxUtil.Exclamation("左边列表为空,无法选择属性!"); return; } if (listBoxProps.SelectedItems.Count == 0) { MessageBoxUtil.Exclamation("请选择左边的属性!"); return; } //if (listBoxSelProps.Items.Count == listBoxFiles.Items.Count) //{ // MessageBoxUtil.Exclamation("选择的属性数已经达到了上限:" + listBoxFiles.Items.Count); // return; //} //var diff = listBoxProps.SelectedItems.Count + listBoxSelProps.Items.Count - listBoxFiles.Items.Count; //if (diff > 0) //{ // MessageBoxUtil.Exclamation("选择的属性数已经超过了上限,超过个数:" + diff); // return; //} var startIndex = listBoxProps.SelectedIndices[0]; var items = Utility.RemoveSelectedItems(listBoxProps); Utility.AddSelectedItems(listBoxSelProps, items); if (listBoxProps.Items.Count > 0) { if (startIndex >= listBoxProps.Items.Count) { startIndex = listBoxProps.Items.Count - 1; } listBoxProps.SelectedIndex = startIndex; } }