Esempio n. 1
0
        //删除产品按键响应事件
        private void delPointBtn_Click(object sender, EventArgs e)
        {
            //先判断是否包含
            if (pointCombo.Items.Count > 0)
            {
                DialogResult res = MessageBox.Show("您确定要删除该点吗?", "温馨提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation);

                if (res == DialogResult.OK)
                {
                    int index = pointCombo.SelectedIndex;
                    pointCombo.Items.RemoveAt(index);
                    pointList.RemoveAt(index);

                    for (int i = 0; i < rowN; i++)
                    {
                        dataGridView1.Rows[i].Cells[index + 1].Value = "";
                    }

                    iniFileOp.DeleteKey(curProductName, curPoint);

                    //并及时更新显示
                    if (pointCombo.Items.Count > 0)
                    {
                        pointCombo.SelectedIndex = 0;
                        curPoint = pointCombo.SelectedItem.ToString();
                    }
                    else
                    {
                        pointCombo.Items.Clear();
                        pointCombo.Text = "";
                    }
                }
            }
        }