C# 更改图片框中背景图像的大小模式
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10211237/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Changing the sizemode of a background image in picturebox
提问by Antonio Teh Sumtin
My aim was to change the background image and set it's SizeMode as Stretch. Tried a lot so far, any ideas?
我的目标是更改背景图像并将其 SizeMode 设置为 Stretch。到目前为止尝试了很多,有什么想法吗?
EDIT: I am working in C# forms application. Tried simply setting size mode of bg picture:
编辑:我在 C# 表单应用程序中工作。尝试简单地设置背景图片的大小模式:
picturebox1.BackgroundImage = Properties.Resources.Image;
picturebox1.SizeMode = PictureBoxSizeMode.StretchImage;
tried to move around it... no success...
试图绕过它……没有成功……
采纳答案by Skalli
Look at BackgroundImageLayout.
Example:
看看BackgroundImageLayout。
例子:
whatever.BackgroundImageLayout = ImageLayout.Stretch

