模仿/模拟特定的屏幕分辨率来调整 WinForms 的大小?
我目前正在开发一个 Winforms 应用程序,它将在非常特定的平板电脑上运行。
我的开发环境使用双 17 英寸显示器,其尺寸远大于 10.4 英寸(1024x768)的平板电脑屏幕尺寸。
由于我公司的采购部门的原因,平板电脑的交付要等到完全进入设计周期后才会交付。
是否可以模仿平板电脑的尺寸,以便我可以调整我的表格以匹配?
I am currently developing a Winforms Application that will run on a very specific tablet PC.
My development environment uses dual-17" monitors which are far bigger than the tablet screen size of 10.4" (1024x768).
Due to the purchasing department at my company the delivery of the tablet will not be until well into the design cycle.
Is it possible to mimic the tablet size so that I can adjust my forms to match?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您有两种选择:
请注意,您的表单仍然必须相对灵活,因为用户可能会将其任务栏配置为不同的位置或不同的大小,从而影响您的应用程序的可用工作区。
You have couple of options:
Note that your form will have to still be relatively flexible, since users might configure their taskbar to be at a different position, or different size, thus affecting the available workspace for your app.
事实上,10.4" 上的分辨率为 1024x768,这意味着像素比典型的 PC 显示器更密集。这意味着显示器上 10 像素高的文本可能看起来不错,但平板电脑上 10 像素高的文本可能很小并且几乎无法阅读(甚至 除非您能找到具有相似像素
密度的显示器,否则我认为您无法正确模仿它,即使您可以将应用程序缩小到显示器的 10.4 英寸部分,但现在您可能正在处理。具有子像素着色功能,看起来比平板电脑上更模糊。
您可以做的最好的事情是将您的一台显示器设置为 1024x768(不拉伸以填充屏幕!),或者只是将您的应用程序设置为该尺寸并观察它以考虑到它实际上会更小。
The fact that you have 1024x768 on 10.4" means the pixels are denser than your typical PC monitor. That means that text 10 pixels high on your monitor might look fine, but 10 pixels high on the tablet PC may be tiny and almost unreadable (even without loss of resolution).
Unless you can find a monitor with similar pixel density, I don't think you can properly mimic it. Even if you can shrink the application to a 10.4" section of the monitor, now you're probably dealing with sub-pixel shading which will look blurrier than on the tablet PC.
The best you can probably do is setting one of your monitors to 1024x768 (without stretching to fill the screen!), or just set your app to that size and eyeball it to take into account that it will actually be smaller.
您可以尝试将主窗体托管在用户控件或限制相关大小的其他窗体中。然而,该表单并不是“顶级”表单,但其外观和行为相当类似。
您可以执行正常形式的操作(最小化/最大化/移动/调整大小/等),这样您就可以感受到它的样子和特定的大小。
但在这种情况下,最好始终按照您必须瞄准的最小分辨率设计 UI,并使其在较大的显示器上向上缩放。
You could try hosting your main form inside a user control or another form limited to the relevant size. However, the form is then not a "top level" form, but fairly closely looks and behaves like one.
You can perform normal form actions (minimise / maximise / move / resize / etc) so you can get a feel for what it is like and a certain size.
However in this instance, its best to always design the UI for the minimum resolution you have to target, and have it scale upwards on larger monitors.
非常简单 - 如果您担心尺寸,或者用户必须使用触摸屏,请使用 10pt+ 字体开始表单
非常酷 - 将表单尺寸设计为,哦,950x650。尝试每个控件的 anchor 属性。允许您制作基本上完全可调整大小的控件(如果您对分组框/面板上的锚点及其内部的控件有创意)。
然后将表单设置为在平板电脑上最大化(或者例如,如果屏幕尺寸 <= 1280x1024 - Anchor 属性对于尺寸增加看起来合理有其限制)。
very easy - if you're concerned about size, or users have to use the touch screen, start your form out with 10pt+ font
very cool - design the form size as, oh, 950x650. Experiment with the anchor property of each control. Allows you to make basically totally resizable controls (if you get creative with the anchor on groupboxes/panels and the controls inside them).
then set your form to maximize itself on the tablet PC (or e.g., if screen size is <= 1280x1024 - the Anchor property has its limitations as to what size increase looks reasonable).