Image coming out the wrong size...

Nightmare

New member
Joined
Dec 6, 2003
Messages
1
Hey everyone! Ok...here is a problem I have come across while programming in C#.

When I draw a certain picture to a picturebox it is not coming out at its correct size, but instead, a slightly bigger stretched out version of the picture. This only happens to certain picture files.

When the image property is set instead, the picture is of the appropriate size.

To recreate the problem I added a picturebox to a form, increased its size slighty, and set its image property to the image file I have attached. I then coded its click event as follows.

Code:
private void pictureBox1_Click(object sender, System.EventArgs e)
{
  Graphics g = pictureBox1.CreateGraphics();
  g.DrawImageUnscaled(pictureBox1.Image, 20, 20);
}

Any ideas why this is happening? Is it just on my end? It could be something stupidly overlooked on my part...I dunno...
 

Attachments

Last edited by a moderator:
Back
Top