• Advertisement
Sign in to follow this  

C# Bitmap Size Issues?

This topic is 3827 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm loading in Bitmaps into C# and displaying them on a form. I'm just using the following:
Bitmap bmp = new Bitmap(ofn.FileName);
this.Width = bmp.Size.Width;
this.Height = bmp.Size.Height;


private void TB_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
   if (bmp == null)
   Graphics g = e.Graphics;
   g.DrawImage(bmp, 0, 0);
I've noticed, however, that when the images are displayed on the form, that they appear to be stretched, usually in the same aspect ratio. I know this by comparing them with the same images in Photoshop and the fact that the code to resize the window, doesn't fully expand to show the whole image (even considering the title bar). Any idea why this might be or how I can fix it?

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement