I
I
Isaac Rahmani2020-12-26 11:52:05
PNG
Isaac Rahmani, 2020-12-26 11:52:05

How to display a png file in PictureBox?

private void Method(PictureBox picturebox)
{
int zarik = rand.Next(1, 7);

switch (zarik)
{
case 1:
picturebox.Image = Properties.Resources._1;
break;
case 2:
picturebox.Image = Properties.Resources._2;
break;
case 3:
picturebox.Image = Properties.Resources._3;
break;
case 4:
picturebox.Image = Properties.Resources._4;
break;
case 5:
picturebox.Image = Properties.Resources._5;
break;
case 6:
picturebox.Image = Properties.Resources._6;
break;
default:
picturebox.Image = Properties.Resources.NoZariki;
break;
}
Is it possible to use short picturebox.Image = Properties.Resources."zarik".png;
Thank you in advance.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question