C# winforms Picturebox, backgroundimage zoomed at the top?

Posted by Oskar Kjellin on Stack Overflow See other posts from Stack Overflow or by Oskar Kjellin
Published on 2010-05-14T09:07:21Z Indexed on 2010/05/14 9:14 UTC
Read the original article Hit count: 715

Filed under:
|
|
|
|

I have a picturebox where I set change the BackgroundImage frequently. I have a the BackgroundImageLayout set to Zoom.

The problem is that when an image does not have the same scale as the picturebox, the picture is drawn in the middle. That is, the top and the bottom padding of the picturebox is always the same.

I would like for the BackgroundImage to always be aligned at the top. What is the easiest and most performance efficient way of doing this?

I can add that I download the images from the internet. If you think that the best way to deal with this is to resize them at that point I can do that :)

© Stack Overflow or respective owner

Related posts about c#

Related posts about picturebox