我正在Windows 10和Visual Studio 2017 Community Edition上制作Windows窗体CLR应用程序。但是,我在运行时正确渲染图片时遇到问题。
这是png文件(274x184 png文件)我想在窗口中显示为标签:
我在设计器窗口中将标签添加到窗口中,但它根本不会出现:
以下是标签属性(我将AutoSize设置为False并且不会更改任何内容):
我在这里缺少什么吗?是否有标签设置错误?
答案 0 :(得分:0)
Remove the MaximumSize
restriction. Set it to 0,0
. As far as that goes, I would remove the MinimumSize
restriction as well. Also, if you want the image to stay centered, then I would remove the anchors so that it isn't anchored at all, and because the image is resizing on you, you may need to recenter it programmatically when the form loads. Also, the AutoSize
was not working because you set the MinimumSize
and MaximumSize
properties to the same value - the control could not resize. Turn AutoSize
back to true
.