Esempio n. 1
0
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            map     = new Tile[5, 5];
            mapSize = new Size(5, 5);
            for (int i = 0; i < mapSize.Width; i++)
            {
                for (int j = 0; j < mapSize.Height; j++)
                {
                    map[i, j] = new Tile(-1, 0);
                }
            }
            selectedTile  = new Tile(0, 0);
            selectedPoint = new Point(1, 1);

            bitmap = Properties.Resources._default;
            TileGraphic.AutoScrollMinSize = bitmap.Size;
            //Adjust
            Graphics g = TileGraphic.CreateGraphics();

            bitmap.SetResolution(g.DpiX, g.DpiY);
            g.Dispose();
            graphicsPanel1.AutoScrollMinSize = new Size(mapSize.Width * tileSize.Width, mapSize.Height * tileSize.Height);

            graphicsPanel1.Invalidate();
            TileGraphic.Invalidate();
        }
Esempio n. 2
0
        private void modalDialogToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ModalDialog dlg = new ModalDialog();

            dlg.tileSetSizeHeight = tileSetSize.Height;
            dlg.tileSetSizeWidth  = tileSetSize.Width;
            dlg.mapSizeHeight     = mapSize.Height;
            dlg.mapSizeWidth      = mapSize.Width;
            dlg.tileSize          = tileSize.Width;
            dlg.myBitmap          = bitmap;

            dlg.Apply += new ApplyEventHandler(dlg_Apply);
            if (DialogResult.OK == dlg.ShowDialog())
            {
                if (dlg.myBitmap != null)
                {
                    bitmap = new Bitmap(dlg.myBitmap);
                }
                tileSize.Width  = dlg.tileSize;
                tileSize.Height = dlg.tileSize;

                tileSetSize.Width  = dlg.tileSetSizeWidth;
                tileSetSize.Height = dlg.tileSetSizeHeight;


                Tile[,] aux = new Tile[dlg.mapSizeWidth, dlg.mapSizeHeight];
                Size auxSize = new Size(dlg.mapSizeWidth, dlg.mapSizeHeight);
                for (int i = 0; i < auxSize.Width; i++)
                {
                    for (int j = 0; j < auxSize.Height; j++)
                    {
                        if (i < mapSize.Width && j < mapSize.Height)
                        {
                            aux[i, j] = map[i, j];
                        }
                        else
                        {
                            aux[i, j] = new Tile(0, 0);
                        }
                    }
                }
                map     = new Tile[dlg.mapSizeWidth, dlg.mapSizeHeight];
                mapSize = new Size(dlg.mapSizeWidth, dlg.mapSizeHeight);
                map     = aux;

                Graphics g = TileGraphic.CreateGraphics();
                bitmap.SetResolution(g.DpiX, g.DpiY);
                g.Dispose();
                graphicsPanel1.AutoScrollMinSize = new Size(mapSize.Width * tileSize.Width, mapSize.Height * tileSize.Height);
                graphicsPanel1.Invalidate();
                TileGraphic.Invalidate();
                selectedTile  = new Tile(0, 0);
                selectedPoint = new Point(1, 1);
            }
        }
Esempio n. 3
0
        public Form1()
        {
            InitializeComponent();
            TileGraphic.AutoScrollMinSize = bitmap.Size;
            //Adjust
            Graphics g = TileGraphic.CreateGraphics();

            bitmap.SetResolution(g.DpiX, g.DpiY);
            g.Dispose();
            graphicsPanel1.AutoScrollMinSize = new Size(mapSize.Width * tileSize.Width, mapSize.Height * tileSize.Height);
        }
Esempio n. 4
0
        void dlg_Apply(object sender, ApplyEventArgs e)
        {
            if (e.Map != null)
            {
                bitmap = new Bitmap(e.Map);
            }
            tileSetSize.Width  = e.TileSetSizeWidth;
            tileSetSize.Height = e.TileSetSizeHeight;

            tileSize.Width  = e.TileSize;
            tileSize.Height = e.TileSize;

            Tile[,] aux = new Tile[e.MapSizeWidth, e.MapSizeHeight];
            Size auxSize = new Size(e.MapSizeWidth, e.MapSizeHeight);

            for (int i = 0; i < auxSize.Width; i++)
            {
                for (int j = 0; j < auxSize.Height; j++)
                {
                    if (i < mapSize.Width && j < mapSize.Height)
                    {
                        aux[i, j] = map[i, j];
                    }
                    else
                    {
                        aux[i, j] = new Tile(0, 0);
                    }
                }
            }
            map     = new Tile[e.MapSizeWidth, e.MapSizeHeight];
            mapSize = new Size(e.MapSizeWidth, e.MapSizeHeight);
            map     = aux;
            TileGraphic.AutoScrollMinSize = bitmap.Size;

            Graphics g = TileGraphic.CreateGraphics();

            bitmap.SetResolution(g.DpiX, g.DpiY);
            g.Dispose();
            graphicsPanel1.AutoScrollMinSize = new Size(mapSize.Width * tileSize.Width, mapSize.Height * tileSize.Height);
            graphicsPanel1.Invalidate();
            TileGraphic.Invalidate();
            selectedTile  = new Tile(0, 0);
            selectedPoint = new Point(1, 1);
        }