public MiniMap(MiniMapInfo minimapInfo, Portal portal = null) { InitializeComponent(); mmi = minimapInfo; if (portal != null) { object[] x = new object[] { "MiniMap X:", portal.X, " Y:", portal.Y }; Text = string.Concat(x); double width = (double)(portal.X - mmi.centerX * -1); width = width / (double)mmi.width; width = width * (double)mmi.canvas.Width; double y = (double)(portal.Y - mmi.centerY * -1); y = y / (double)mmi.height; y = y * (double)mmi.canvas.Height; SolidBrush solidBrush = new SolidBrush(Color.Red); Graphics graphic = Graphics.FromImage(mmi.canvas); graphic.FillRectangle(solidBrush, new Rectangle((int)width - 3, (int)y - 3, 7, 6)); solidBrush.Dispose(); graphic.Dispose(); } bm = mmi.canvas; mmi.canvas = MiniMap.ResizeBitmap(mmi.canvas, (int)((double)mmi.canvas.Width * 1.5), (int)((double)mmi.canvas.Height * 1.5)); pictureBox.Image = mmi.canvas; pictureBox.Height = mmi.canvas.Height; pictureBox.Width = mmi.canvas.Width; base.Size = new System.Drawing.Size(mmi.canvas.Width + 18, mmi.canvas.Height + 36); }
private void MiniMap_Resize(object sender, EventArgs e) { System.Drawing.Size size = base.Size; int width = size.Width - 36; System.Drawing.Size size1 = base.Size; int height = size1.Height - 72; if (width < 20) { width = 20; } if (height < 40) { height = 40; } mmi.canvas = MiniMap.ResizeBitmap(bm, width, height); pictureBox.Image = mmi.canvas; pictureBox.Height = mmi.canvas.Height; pictureBox.Width = mmi.canvas.Width; }