问题描述
我正在使用图片框显示图像,如果窗口最大化,如何将图像适合窗口.现在,当我最大化窗口时,图像将停留在其原始位置.
I am using a picturebox to display the image, how do i fit the image to the window if the window is maximized. Right now, when i maximize the window the image stays in its original position.
谢谢
巴拉尼(Bharani)
Bharani
推荐答案
如果您要谈论的是在窗体窗口中调整图片框的大小,则图片框锚点"属性控制当窗口大小更改时图片框如何调整大小.如果将其锚定在顶部,底部,左侧和右侧,则图片框大小 并调整到窗口.只需检查一下您是否没有意外设置MaximumSize值即可.
If you are talking about the picturebox sizing within the form window, then the picturebox Anchor property controls how the picturebox resizes when the window size changes. If you anchor it to top, bottom, left and right then the picturebox size andjusts to the window. Just check that you have not accidentally set a MaximumSize value.
如果您正在谈论图片框内图像大小的方式,则需要查看图片框的SizeMode属性.参见:
https://msdn.microsoft.com /en-us/library/system.windows.forms.picturebox.sizemode(v=vs.110).aspx
If you are talking about the way the image sizes within the picturebox then you need to look at the picturebox SizeMode property. See:
https://msdn.microsoft.com/en-us/library/system.windows.forms.picturebox.sizemode(v=vs.110).aspx
这篇关于当窗口最大化时适合图像-使用Picturerbox控件.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!