表单调整大小控件问题
我制作了一个简单的应用程序,其中 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
那只是无效的代码。 StartPosition 是一个属性,您将它视为一种方法。它也不占用一个位置。我对预期代码的最佳猜测:
在实现预期设计时您会遇到更多麻烦。应该只有一个 MDI 主窗口。 MDI 子窗口不能是无边框的。
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:
You'll run into more trouble implementing your intended design. There should be only one MDI main window. MDI child windows cannot be borderless.
不用担心起始位置、大小和边界,为什么不能(在子窗体中)设置:
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