public MapListForm(bool opentempmap) { InitializeComponent(); DialogResult = DialogResult.Cancel; OpenTempMap = opentempmap; DataTable table; if (opentempmap) { this.Text = "选择要恢复的地图"; table = MapDBClass.GetTempMapList(); } else { table = MapDBClass.GetMapList(); } dataGridView1.DataSource = table; btnDelete.Enabled = table.Rows.Count > 0; button1.Enabled = table.Rows.Count > 0; }