winforms VB.NET表格高度问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35848/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 16:37:10  来源:igfitidea点击:

VB.NET form Height Question

vb.netwinforms

提问by Krantz

I have a VB6.0 project and I want to convert it in VB.Net.

我有一个 VB6.0 项目,我想在 VB.Net 中转换它。

In my VB6.0 application some of the MDI Child form's height is 17000 and width is 13000. Now I want to set the same form size in VB.Net forms, but it allows maximum form width = 1036, height = 780 for resolution 1024x768.

在我的 VB6.0 应用程序中,一些 MDI 子窗体的高度为 17000,宽度为 13000。现在我想在 VB.Net 窗体中设置相同的窗体大小,但它允许最大窗体宽度 = 1036,高度 = 780,分辨率为 1024x768 .

How can I increase form size with same resolution?

如何以相同的分辨率增加表单大小?

Also I want to print this from so, I can not use auto scroll property of vb.net forms.

我也想打印这个,所以我不能使用 vb.net 表单的自动滚动属性。

Thaks

塔克斯

回答by Matt Dawdy

Your classic VB units are in what are called "twips". You will most likely be able to divide those numbers by 12 or 15 (depending on if you are using large or small fonts) and you will get a certain number of pixels.

您的经典 VB 单位是所谓的“缇”。您很可能能够将这些数字除以 12 或 15(取决于您使用的是大字体还是小字体),您将获得一定数量的像素。

回答by Rob Cooper

I done some Googling on this, and came across this..

我对此进行了一些谷歌搜索,并遇到了这个..

Yes, this size of the form is limited to the size of the desktop (more specifcally SystemInformation.MaxWindowTrackSize). This is done in the Form.SetBoundsCore protected virtual method. This behaviour cannot be changes or at least without a great deal of work and using PInvoke.

是的,表单的这个大小受限于桌面的大小(更具体地说是 SystemInformation.MaxWindowTrackSize)。这是在 Form.SetBoundsCore 受保护的虚拟方法中完成的。这种行为不能改变,或者至少不需要大量的工作和使用 PInvoke。

Also supported here

这里也支持

The size of the form in the designer is limited by your screen size.

It sounds like you have your display at 1600x1200, hence the designer won't let you go larger then 1212.

If you had your display at 1280x1024, then the designer wouldn't let you go larger then 1036.

I'm not really sure why the size of the form in the designer is limited to the screen size, as I may deploy on a machine that has a larger screen size them my development machine...

设计器中表单的大小受屏幕大小的限制。

听起来你的显示器是 1600x1200,因此设计师不会让你比 1212 大。

如果你的显示器是 1280x1024,那么设计师不会让你比 1036 大。

我不太确定为什么设计器中表单的大小仅限于屏幕尺寸,因为我可能会在我的开发机器上部署具有更大屏幕尺寸的机器......

So looks like it cannot be done.. Thats some strange behaviour since it looks like you are limited to whatever your dev machine is..

所以看起来它无法完成..这是一些奇怪的行为,因为看起来你被限制在你的开发机器上......

I think the only way to do it is to size to the maximum resolution possible, set the form size, then revert back, but never touch the size again.

我认为唯一的方法是将大小调整为可能的最大分辨率,设置表单大小,然后还原,但永远不要再次触摸大小。

回答by Eduardo Molteni

You are limited in the designer, but not in code:

您在设计器中受到限制,但在代码中不受限制:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Me.Height = 17000 'or whatever you need
    Me.Width = 13000
End Sub

回答by jfs

I think the VB6 units are not the same with the VB.Net one. So you have to do a conversion.

我认为 VB6 单元与 VB.Net 单元不一样。所以你必须做一个转换。