模仿/模拟特定的屏幕分辨率来调整 WinForms 的大小?

发布于 2024-09-07 03:35:19 字数 194 浏览 9 评论 0原文

我目前正在开发一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

£冰雨忧蓝° 2024-09-14 03:35:19

您有两种选择:

  • 将其中一个屏幕设置为平板电脑分辨率。您可能需要将任务栏移至该屏幕以获得适当大小的工作区。
  • 安装 Virtual PC 并创建具有平板电脑分辨率的虚拟机。
  • 将主窗体大小明确设置为平板电脑分辨率。为了获得最佳结果,请将其调整为适当的工作区大小,而不是桌面大小。

请注意,您的表单仍然必须相对灵活,因为用户可能会将其任务栏配置为不同的位置或不同的大小,从而影响您的应用程序的可用工作区。

You have couple of options:

  • set one of your screens to the tablet resolution. You might need to move your taskbar to that screen to get the proper-sized workspace.
  • install Virtual PC and create a VM with the tablet resolution.
  • set your main form size explicitly to the tablet PC resolution. For best results size it to the proper workspace size, not the desktop size.

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.

梦里人 2024-09-14 03:35:19

事实上,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.

温柔嚣张 2024-09-14 03:35:19

您可以尝试将主窗体托管在用户控件或限制相关大小的其他窗体中。然而,该表单并不是“顶级”表单,但其外观和行为相当类似。

您可以执行正常形式的操作(最小化/最大化/移动/调整大小/等),这样您就可以感受到它的样子和特定的大小。

但在这种情况下,最好始终按照您必须瞄准的最小分辨率设计 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.

貪欢 2024-09-14 03:35:19

非常简单 - 如果您担心尺寸,或者用户必须使用触摸屏,请使用 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).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文