在Visual Studio设计窗体大小的限制屏幕分辨率? [英] Is the size of a Form in Visual Studio designer limited to screen resolution?

查看:3702
本文介绍了在Visual Studio设计窗体大小的限制屏幕分辨率?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么,这在Visual Studio的WinForms设计师,我不能增加我目前工作的屏幕的分辨率上面我的窗体的大小?我认为应该以某种方式有可能制定旨在以较低的资源系统上更高的分辨率的应用程序。这将在调试过程中夹形式的事实,不应该是一个问题。是否有可能在Visual Studio为此,一些设置我似乎无法找到?

Why is it, that in the Visual Studio WinForms designer I cannot increase the size of my Form above the resolution of the screen I am currently working on? I think it should somehow be possible to develop an application aimed at higher resolutions on a lower res system. The fact that this would clip the Form during debugging should not be an issue. Is there perhaps some setting in Visual Studio for this, which I cannot seem to find?

编辑:
我的主要问题是,我需要能够设计一个(举例来说)1440尺寸的窗体上的笔记本采用了(例如)屏幕1360x768的

My main issue is that I need to be able to design a (for example) 1440x900 sized form on a laptop with a (for example) 1360x768 screen.

推荐答案

不幸的是(我希望别人会发布一个更好的解决方案!),我所知道的唯一的解决方法是将表单内的面板。

Unfortunately (I hope someone else will post a better solution!), the only workaround I'm aware of is to place a panel inside the form.

设置父窗体为true的自动滚动自动调整大小属性。然后增加面板尺寸到所需的大小。窗体本身仍不会得到任何比你的屏幕分辨率较大,但它会显示滚动条,这样至少可以使用设计器拖放超出你的尺寸限制控制等在较大的面板。

Set the Autoscroll and AutoSize properties of the Parent Form to true. Then increase the panel size to the desired size. The form itself will still not get any larger than your screen resolution, but it will show scroll bars, so at least you can use the designer to drop controls etc beyond your size limitations onto the larger panel.

然后,您可能需要添加一些code键调节在运行时的形式大小,使其大到足以显示没有滚动条(也许还禁用自动滚动属性)面板。

Then, you may need to add some code to adjust the the forms size at run-time so that it is large enough to show the panel without scroll bars (and perhaps also disable the Autoscroll property).

我知道,这不是一个特别好解决办法...

I know, It's not a particularly nice workaround...

修改

看起来这是故意的,并且设计:

Looks like this is intentional and by design:

<一个href=\"https://connect.microsoft.com/VisualStudio/feedback/details/350887/windows-form-clipped-at-run-time-to-screen-resolution\">MSDN

物业Form.Size:
  此属性的最大值由限制
  在其上的形式运行屏幕的分辨率。该值不能
  是在每个屏幕尺寸大于12像素(水平+ 12
  和垂直+ 12)。

Property Form.Size: The maximum value of this property is limited by the resolution of the screen on which the form runs. The value cannot be greater than 12 pixels over each screen dimension (horizontal + 12 and vertical + 12).

和再次<一个href=\"https://connect.microsoft.com/VisualStudio/feedback/details/350887/windows-form-clipped-at-run-time-to-screen-resolution\">Microsoft连接/公共Bug跟踪:

发布者微软在10/9/2008上午12时18

您的意见谢谢
  在.NET Framework!

Thanks for your feedback on the .NET Framework!

您已经报告的问题实际上是由设计。

The issue that you have reported is actually By Design.

在MSDN在<一个href=\"http://msdn.microsoft.com/en-us/library/25w4thew.aspx\">http://msdn.microsoft.com/en-us/library/25w4thew.aspx,您
  可以在主题Form.Size物业找到以下信息:

In MSDN at http://msdn.microsoft.com/en-us/library/25w4thew.aspx, you can find the following information at the topic Form.Size Property:

此属性的最大值由的分辨率的限制
  屏幕上的形式运行。的值不能大于12
  在每个屏幕尺寸像素(水平+ 12和垂直+ 12)。

The maximum value of this property is limited by the resolution of the screen on which the form runs. The value cannot be greater than 12 pixels over each screen dimension (horizontal + 12 and vertical + 12).

因此​​,我们不能无限期地扩大我们的形式。此行为是
  与其他软件,如记事本和Microsoft画图是一致的。

Therefore, we can't enlarge our forms indefinitely. This behavior is consistent with other software, such as Notepad and Microsoft Paint.

此行​​为在mothed Form.SetBoundsCore定义(...)与
  以下code:

This behavior is defined in the mothed Form.SetBoundsCore(...) with the following code:

尺寸最大= SystemInformation.MaxWindowTrackSize;

Size max = SystemInformation.MaxWindowTrackSize;

如果(高度>最大高度){

if (height > max.Height) {

height = max.Height; }

如果(宽度>最大宽度){

if (width > max.Width) {

width = max.Width; }

[...]

谢谢,UIFx团队

EDIT2

由于该检查是在Forms.SetBoundsCore硬$ C $像CD(使用ILSpy作为一个反编译器):

Since the check is hardcoded in Forms.SetBoundsCore like (using ILSpy as a decompiler):

if (this.WindowState == FormWindowState.Normal && (base.Height != height || base.Width != width))
    {
        Size maxWindowTrackSize = SystemInformation.MaxWindowTrackSize;
        if (height > maxWindowTrackSize.Height)
        {
            height = maxWindowTrackSize.Height;
        }
        if (width > maxWindowTrackSize.Width)
        {
            width = maxWindowTrackSize.Width;
        }
    }

和SetBoundsCore是受保护的功能,也许你可以尝试从Windows.Forms.Form派生一个类,重写SetBoundsCore,不执行这个检查你的SetBoundsCore的版本?如果它工作,虽然我还没有尝试过...

and SetBoundsCore is a protected function, perhaps you could try deriving a class from Windows.Forms.Form, override SetBoundsCore and don't enforce this check in your version of SetBoundsCore? I haven't tried if it works though...

这篇关于在Visual Studio设计窗体大小的限制屏幕分辨率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆