public static void ResizeImage() { if (Program.formStartPage != null) { double width = imageSea.Width; double height = imageSea.Height; int widthMap = Program.formStartPage.GetMapWidth(); int heightMap = Program.formStartPage.GetMapHeight(); //double ratio = height / width; double ratioWidth = widthMap / width; double ratioHeight = heightMap / height; if (ratioWidth > ratioHeight) { Program.formStartPage.SetMapImage(FunctionLayouts.ResizeImage(imageSea, (int)Math.Round(width * ratioHeight), (int)Math.Round(height * ratioHeight))); } else { Program.formStartPage.SetMapImage(FunctionLayouts.ResizeImage(imageSea, (int)Math.Round(width * ratioWidth), (int)Math.Round(height * ratioWidth))); } } }
private void FormStartPage_Load(object sender, EventArgs e) { //shows map on application start //resize is not working properly in this case FunctionLayouts.ResizeImage(); }
private void Form1_Resize(object sender, EventArgs e) { FunctionLayouts.ResizeImage(); }
private void buttonPolen_Click(object sender, EventArgs e) { FunctionLayouts.ActivateCountry(sender as Button, e); }