private void importTilesetReplaceToolStripMenuItem_Click(object sender, EventArgs e) { if (!m_bAddTileset && DialogResult.Yes == MessageBox.Show(this, "Are you sure you want to remove the " + m_strTilesetFilenames[m_nCurrTilesetIndex] + " tile set?", "Replace tile set...", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning)) { if (m_impTsDlg == null) { m_tsTileset[m_nCurrTilesetIndex] = null; tabControl1.TabPages.RemoveAt(m_nCurrTilesetIndex+1); m_bJustClick = true; tabControl1.SelectedIndex = tabControl1.TabCount - 1; if (tabControl1.TabCount > 0 && m_tsTileset[0] == null) { m_nCurrTilesetIndex = 1; } m_bDontDraw = true; m_impTsDlg = new ImportTilesetDlg(m_mMap.NCellWidth, m_mMap.NCellHeight); m_impTsDlg.Text = "Replace Tileset..."; m_impTsDlg.FormClosing += new FormClosingEventHandler(impTsDlg_Close); m_impTsDlg.createPushed += new EventHandler(impTsDlg_CreatePushed); m_impTsDlg.Show(this); } } }
void impTsDlg_Close(object sender, FormClosingEventArgs e) { m_impTsDlg = null; m_bDontDraw = false; }
private void importTilesetAddToolStripMenuItem_Click(object sender, EventArgs e) { m_bAddTileset = true; if (m_impTsDlg == null) { m_nCurrTilesetIndex = tabControl1.TabCount - 1; if (m_nCurrTilesetIndex == MAX_NUM_TILESETS) { m_nCurrTilesetIndex = MAX_NUM_TILESETS - 1; MessageBox.Show(this, "You cannot add any more tilesets.", "Tileset limit reached!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } m_bDontDraw = true; m_impTsDlg = new ImportTilesetDlg(m_mMap.NCellWidth, m_mMap.NCellHeight); m_impTsDlg.Text = "Add New Tileset..."; m_impTsDlg.FormClosing += new FormClosingEventHandler(impTsDlg_Close); m_impTsDlg.createPushed += new EventHandler(impTsDlg_CreatePushed); m_impTsDlg.cancelPushed += new EventHandler(m_impTsDlg_cancelPushed); m_impTsDlg.Show(this); } }