samedi 28 décembre 2019

pictureBox.Image condition isn't true even though picture is loaded

Code:

private async void pictureBox5_Click(object sender, EventArgs e)
    {
        if (pictureBox5.Image == Uny.Properties.Resources.Uny_Slider_one)
        {
            pictureBox5.Image = Uny.Properties.Resources.activating_gif;
            await Task.Delay(600);
            pictureBox5.Image = Uny.Properties.Resources.Uny_Slider_two;
            LogStatus = 1;
            await Task.Delay(3000);
        }
        if (pictureBox5.Image == Uny.Properties.Resources.Uny_Slider_two)
        {
            pictureBox5.Image = Uny.Properties.Resources.deactivating_gif;
            await Task.Delay(600);
            pictureBox5.Image = Uny.Properties.Resources.Uny_Slider_one;
            LogStatus = 0;
        }
    }

All the images were imported in the Resources & all the names are correct. pictureBox5 is normally set to Uny_Slider_One, I just don't see the error? I even said picturebox5.Image = Uny.Properties.Resources.Uny_Slider_one; directly after InitalizeComponent();!

Aucun commentaire:

Enregistrer un commentaire