private Bitmap img;
public void ShowMyImageTrayType(String fileToDisplay, int xSize, int ySize)
{
if (img != null)
{
img.Dispose();
}
pBoxTraySize.SizeMode = PictureBoxSizeMode.StretchImage;
img = new Bitmap(fileToDisplay);
pBoxTraySize.ClientSize = new Size(xSize, ySize);
pBoxTraySize.Image = img;
}
I use the above code to display image inside PictureBox but I get (Parameter is not valid.) error