Example #1
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (dataGridView1.RowCount <= 0 || dataGridView1.SelectedRows.Count <= 0)
     {
         return;
     }
     if (!OpenTempMap)
     {
         if (MessageBox.Show("确定要删除选定的地图吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
         {
             decimal mapid = (decimal)dataGridView1.SelectedRows[0].Cells["mapid"].Value;
             MapDBClass.DeleteMap(mapid);
             dataGridView1.Rows.Remove(dataGridView1.SelectedRows[0]);
         }
     }
     button1.Enabled = dataGridView1.RowCount > 0;
 }