WPF中的Winform自定义控件
我在 WPF/XAML 窗口中插入自定义 winform 控件,但是我意识到尺寸似乎非常不同,例如,当通过 WindowsFormsHost 放置在容器中时,我在 winform 中设计的宽度为 730 像素730 像素(或者至少我认为它们是像素..)宽,该控件看起来要大得多,并且不适合主机,并导致从右侧和底部进行裁剪。
有人知道如何使这些尺寸匹配吗?我真的很茫然,修复自定义控件以使其看起来像在 WPF 上应有的样子非常困难!请帮忙!
I'm inserting a custom winform control in a WPF/ XAML window, however i'm realising that the sizing seems to be very different, what i designed in winform to be 730pixels wide for instance, when placed via a WindowsFormsHost, in a container 730pixels (or at least i think they're pixels..) wide, the control looks much larger and doesnt fit in the host and results in clipping from the right and bottom.
Would anyone know how to make these sizes match or something? I'm really at a loss and its very difficult to fix a custom control to make it look as it should off hand on WPF! Please help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
WPF 大小不是以像素为单位,而是以 1/96 英寸为单位。您的视频适配器可能设置为 120 DPI,您必须将其宽度设置为 730 / 96 * 120 = 913 单位。
WPF sizes are not in pixels, they are in units of 1/96 inch. Your video adapter is probably set to 120 DPI, you'd have to make it 730 / 96 * 120 = 913 units wide.