Beispiel #1
0
        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)));
                }
            }
        }
Beispiel #2
0
 private void FormStartPage_Load(object sender, EventArgs e)
 {
     //shows map on application start
     //resize is not working properly in this case
     FunctionLayouts.ResizeImage();
 }
Beispiel #3
0
 private void Form1_Resize(object sender, EventArgs e)
 {
     FunctionLayouts.ResizeImage();
 }
Beispiel #4
0
 private void buttonPolen_Click(object sender, EventArgs e)
 {
     FunctionLayouts.ActivateCountry(sender as Button, e);
 }