pragmus pragmus - 1 month ago 8
C# Question

Image doesn't show in picturebox c#

I want copy image from one picturebox to another. The code below:

PictureBox pictureBoxRain1 = new PictureBox();
pictureBoxRain1.Size = size;
//pictureBoxRain1.Image = (Image)Properties.Resources.kaplja;
pictureBoxRain1.Image = Image.FromFile(@"C:\images\kaplja.png");
//pictureBoxRain1.ImageLocation = pictureBoxRain.I;
//pictureBoxRain1.Image = Graphics.FromImage();
//pictureBoxRain1.InitialImage = Properties.Resources.kaplja;
//pictureBoxRain1.BackgroundImage = Properties.Resources.kaplja;
pictureBoxRain1.Location = new Point(pictureBoxRain.Location.X + pictureBoxGrass.Size.Width + 10, pictureBoxRain.Location.Y);
Controls.Add(pictureBoxRain1);


All anothers properties copy perfectly to
pictureBoxRain1
from
pictureBoxRain
, but image doesn't want show. Where is problem? I checked many variants such as copy image from
Properties.Resources
, and reading direct from file and some others(look comments in code above), but nothing works.

Answer

EDIT

Check the pictureBoxRain1.SizeMode.