表单调整大小控件问题

发布于 2025-01-03 00:21:06 字数 702 浏览 1 评论 0原文

我制作了一个简单的应用程序,其中 MDI 父级通过单击菜单项加载子窗体。(我将在一个更大、更有用的应用程序中实现此功能)...它最初包含一个 MenuStrip 和一个单击 MenuStrip 项目将打开一个新表单(典型的 MDI 父表单样式)。此表单无边框,我希望它适合并填充 MDI 父 MenuStrip 下的剩余空间。

我需要知道要使用的属性才能实现此目的,同时(对于子窗体)以适合显示的任何分辨率的 MDI 父窗体的可用空间。

到目前为止,我尝试过此操作,但收到此错误:属性访问必须分配给该属性或使用其值。

Private Sub frmGenPay_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)       Handles MyBase.Load
    Me.StartPosition(10, 10)
    Call FitToScreenCompanyDetails()
End Sub

在模块中:

 Public Sub FitToScreen()
    frmMDImainform.Size = My.Computer.Screen.Bounds.Size
End Sub

上面的第二个代码是针对 MDI 父窗体的,如果有人也可以给我一些建议,那么这将是真正的启动。

感谢大家的建议。提前致谢!

I made a simple application in which an MDI parent loads a child form at a click of a menu item..(I am going to implement this in a much bigger and more useful application)...It contains initially a MenuStrip and on a click of the MenuStrip item a new form will open (typical MDI parent form style) This form is border less and I would like it to fit and fill the remaining space under the the MDI parents MenuStrip.

I need to know the properties to use in order to achieve this and at the same time (for the child form) to fit into the MDI parent form's free space at any resolution at which the display is.

So far I tried this but I got this error: Property access must assign to the property or use its value.

Private Sub frmGenPay_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)       Handles MyBase.Load
    Me.StartPosition(10, 10)
    Call FitToScreenCompanyDetails()
End Sub

In the module:

 Public Sub FitToScreen()
    frmMDImainform.Size = My.Computer.Screen.Bounds.Size
End Sub

The second code above is for the MDI parent form if someone could give me some suggestions on this too it would be really kick-start things.

Thanks to everyone for any piece of advice. Thanks in Advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

二智少女 2025-01-10 00:21:06
    Me.StartPosition(10, 10)

那只是无效的代码。 StartPosition 是一个属性,您将它视为一种方法。它也不占用一个位置。我对预期代码的最佳猜测:

    Me.StartPosition = FormStartPosition.Manual
    Me.Location = New Point(10, 10)

在实现预期设计时您会遇到更多麻烦。应该只有一个 MDI 主窗口。 MDI 子窗口不能是无边框的。

    Me.StartPosition(10, 10)

That just isn't valid code. StartPosition is a property, you are treating it as though it is a method. Nor does it take a location. My best guess for the intended code:

    Me.StartPosition = FormStartPosition.Manual
    Me.Location = New Point(10, 10)

You'll run into more trouble implementing your intended design. There should be only one MDI main window. MDI child windows cannot be borderless.

じ违心 2025-01-10 00:21:06

不用担心起始位置、大小和边界,为什么不能(在子窗体中)设置:

Me.WindowState = FormWindowState.Maximized
Me.MdiParent = myMDIParent

Instead of worrying about startpositions, sizes and bounds, why can't you just (in the child form) set:

Me.WindowState = FormWindowState.Maximized
Me.MdiParent = myMDIParent

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