Jump to content
  • Advertisement
Sign in to follow this  
acron86

C# Bitmap Size Issues?

This topic is 4101 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)
      return;
   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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!