韩国操作系统上的控件大小增加
我有一个 Windows 窗体,其中有一个指定固定大小的标签控件。它的 Autosize 值为 true,并且最大尺寸包含与控件宽度相同的宽度值,因此,控件仅在需要时增加其高度。这在英语操作系统上运行良好,但是当部署在韩语操作系统上时,宽度会增加并超过表单中设置的最大限制。
我已经使用了 Autoscalemode 的所有值 - 字体、DPI、无、继承,但没有改变任何东西。它可能出了什么问题以及我们如何克服这个问题。
I have a windows Form that has a Label control specified with fixed size. It's Autosize value is true and the maximum size contains the same value for width as the width of the control, so that, the control only increases it's height if the need be. This works fine on English OS, but when this is deployed on say Korean OS, the width increases and crosses the maximum limit set in the form.
I have played with Autoscalemode with all the values - Font, DPI, None, Inherit, but doesn't change a thing. What could be wrong with it and How can we overcome this problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,它会增加,而且实际上是众所周知的(在某些圈子里)行为。字体的测量方式存在一些问题(可能是测量后备字体而不是您定义的字体)。
我不会将大小设置为固定,而是使用 TableLayoutPanel 作为此控件/表单/其他内容的布局管理器,并允许其实际调整大小。您需要稍微尝试一下,但根据我的经验,添加空距离列是有效的(前提是您至少有一个百分比列)。这有点棘手,但我设法通过这种方式修复了类似的缺陷。
Yes, it increases and actually is well known (in some circles) behavior. There is some problem with how font are measured (probably fallback font is measured instead of the one you defined).
Instead of setting the size to fixed, I would use TableLayoutPanel as layout manager for this control/form/whatever and allow it to actually resize. You'll need to play with it a bit, but from my experience adding empty distance column works (provided that you have at least one percentage column). This is a bit tricky, but I managed to fix similar defect this way.
我最近遇到了同样的问题,并通过在主顶级面板中以编程方式将默认字体设置为 Sans Serif 来修复它。我的答案(针对我自己的问题)的详细信息在这里:
https://superuser.com/questions/1093919/is-there-such-a-thing-as-korean-microsoft-windows-10-or-是-it-just-regular-win/1119806#1119806
I've recently had this same issue, and fixed it by programmatically setting the default font to Sans Serif in the main top-level panel. Details of my answer (to my own question) here:
https://superuser.com/questions/1093919/is-there-such-a-thing-as-korean-microsoft-windows-10-or-is-it-just-regular-win/1119806#1119806