예제 #1
0
        private void buttonDelete_Click(object sender, EventArgs e)
        {
            if (listBoxFileNames.Items.Count == 0 || _nOcrChar == null)
            {
                return;
            }

            var oldComboBoxIndex = comboBoxTexts.SelectedIndex;
            var oldListBoxIndex  = listBoxFileNames.SelectedIndex;

            _nOcrDb.Remove(_nOcrChar);
            Changed = true;

            FillComboBox();
            if (comboBoxTexts.Items.Count > oldComboBoxIndex)
            {
                comboBoxTexts.SelectedIndex = oldComboBoxIndex;
                if (listBoxFileNames.Items.Count > oldListBoxIndex)
                {
                    listBoxFileNames.SelectedIndex = oldListBoxIndex;
                }
                else if (listBoxFileNames.Items.Count > 0)
                {
                    listBoxFileNames.SelectedIndex = listBoxFileNames.Items.Count - 1;
                }

                listBoxFileNames.Focus();
            }
        }
예제 #2
0
 private void buttonDelete_Click(object sender, EventArgs e)
 {
     if (_nOcrChar != null)
     {
         _nOcrDb.Remove(_nOcrChar);
         ShowStatus("Character deleted");
     }
 }