form2:
public void setFilename(string sFile)
{
pictureBox1.Image = Image.FromFile(sFile);
}
form 1:
private void button2_Click(object sender, EventArgs e)
{
frmPreview frmPreviewObj = new frmPreview();
frmPreviewObj.setFilename(fname);
//pictureBox1 .Height =fname
frmPreviewObj.Show();
frmPreviewObj.Location = new Point(0,50);
}
here am showing the picture in form2 from button click in form1, i want to chage my second form's form or picture boxes size to the size of the image , how can i do this?
Loading
FroglegPosted Oct 5, 2012, 6:12 PM
{
pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;//makes picturebox same size as image
pictureBox1.Image = Image.FromFile(sFile);
}