Exemplo n.º 1
0
        private void resizeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ResizeMapForm dialog = new ResizeMapForm();

            dialog.WidthBox.Text  = map.SizeX.ToString();
            dialog.HeightBox.Text = map.SizeY.ToString();
            dialog.LeftBox.Text   = "0";
            dialog.TopBox.Text    = "0";

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    int newX = Int32.Parse(dialog.WidthBox.Text);
                    int newY = Int32.Parse(dialog.HeightBox.Text);
                    int dX   = Int32.Parse(dialog.LeftBox.Text);
                    int dY   = Int32.Parse(dialog.TopBox.Text);
                    map.ResizeMap(newX, newY, dX, dY);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error resizing the map: " + ex.Message);
                }
            }
        }