wczytywanie zdjęcia

0

Hej
Ciągle wywala mi błąd w

double zdjecie = ((float)BackgroundImage.Width) / this.ClientSize.Width;

Przesyłam cały kod którym chce to obejść:

var image = new System.Windows.Forms.OpenFileDialog();
            image.Filter = "";
            image.Title = "Select image";
            if (image.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {

                System.IO.FileInfo File = new System.IO.FileInfo(image.FileName);
                BackgroundImage = Image.FromFile(image.FileName);
                BackgroundImageLayout = ImageLayout.Zoom;


if (BackgroundImage == null)
                    {
                        MessageBox.Show("Najpierw wczytaj mapę działki!");
                    }
                    double zdjecie = ((float)BackgroundImage.Width) / this.ClientSize.Width;
0

Zamiast ((float)BackgroundImage.Width) użyj Convert.toDouble(BackgroundImage.Width)

1 użytkowników online, w tym zalogowanych: 0, gości: 1