开发者

C# winforms Picturebox, backgroundimage zoomed at the top?

I have a picturebox where I change the 开发者_如何学JAVABackgroundImage 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 :)


By far the simplest solution is to just change the Size property of the picture box so that the image can be drawn without padding. Implementing your own Paint event handler is possible too, not exactly necessary here I presume.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜