子窗体宽度比VB.NET中的父窗体宽度长 [英] Child Form width longer than Parent Form width in VB.NET

查看:73
本文介绍了子窗体宽度比VB.NET中的父窗体宽度长的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好所有访客
我在vb.net中的子表单有问题.
我有2种形式(1种是父母形式,2种是孩子形式)
在我的父母表格上,我在表格的左侧有1个面板.因此子表单将显示在右侧.
这是我的代码,当按钮child1

Hi all visitors
I have problem with child form in vb.net.
i have 2 forms (1 is parent form and 2 is child form)
on my parent form, i have 1 panel at the left side of form. so the child form will display at the right side.
This is my code when button child1

Dim frm As New frmItemGroup
frm.MdiParent = Me
frm.Show()


当我单击child1按钮时,它显示在右侧.但是子窗体的宽度比父窗体的宽度长.因此,如果我想向子窗体输入数据,则需要滚动.
有人知道如何固定子表格与父表格的宽度匹配吗?

最好的问候,
TONY


when i click on child1 button,it display at the right side. but the child form width is longer than parent form.so i need to scroll if i want to input data to child form.
Anybody know how can i fixed child form match with width of parent form?

Best Regards,
TONY

推荐答案

表单之间没有父子关系.对于MDI,我不计算MDIChild-MDIParent关系,这是另一回事. (此外,谁需要MDI?即使Microsoft也不鼓励.)更准确地说,类Form具有Parent属性,因为该类是Control并继承了Control.Parent,但是尝试将表单插入表单导致异常.因此,此关系在API中已正式存在,但在功能上不存在,因此无法在运行时使用.

现在,关于MDI.这就是为什么我不推荐的原因:
http://en.wikipedia.org/wiki/Multiple_document_interface#Disadvantages [在WPF中使用MDI窗口的问题 [ ^ ],
提供错误的MDIContainer [
There is not parent-child relationships between forms. I don''t count MDIChild-MDIParent relationship for MDI, which is a different thing. (Besides, who needs MDI? It is discourages even by Microsoft.) More exactly, the class Form has Parent property as this class is Control and inherits Control.Parent, but an attempt to insert a form into form causes exception. So, this relationship does formally exist in API but does not functionally exist and cannot be used during run time.

Now, about MDI. Here is why I don''t recommend it:
http://en.wikipedia.org/wiki/Multiple_document_interface#Disadvantages[^],
Question on using MDI windows in WPF[^],
MDIContainer giving error[^].

Honestly, don''t torture yourself and scare off your users. The links above show much better alternatives.

—SA


您是否尝试将第二个表单的windowstate设置为最大化?还是width属性较小?

注意:在mdichild表单上使用windowstate = maximized也会在打开其他子窗口时给您带来问题,因为即使指定了大小,它们也会占用该窗口的大小.

唯一的解决办法是在运行时更改窗口状态或不使用windowstate=maximized
have you tried setting the 2nd form''s windowstate to maximized? or the width property to something smaller?

Note: using the windowstate = maximized on a mdichild form will also give you issues when you open other child windows as they take on the size of the that window even if you specify the size.

The only wy around it is to either change the window state at runtime or not use the windowstate=maximized


这篇关于子窗体宽度比VB.NET中的父窗体宽度长的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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