在父母中完全显示儿童控制 [英] showing child control fully in parent

查看:61
本文介绍了在父母中完全显示儿童控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有

我在c中创建了两个表格。

其中一个是父母,另一个是孩子。

父窗体上面有一个按钮

当我点击按钮时,父窗体以最大化的形式显示子窗体。





但是以子格式我有一个datagirdview数据视图的顶部部分隐藏了父母的按钮



如何解决这个问题

非常感谢非常快速的回答。

hello dear all
I have created two form in c#
one of them is parent and the other one is child.
the parent form contain a button on it's top
when i click on the button the parent form it show child form in maximized form.


but in child form i have a datagirdview top part of the datagirdview hides by parent's button

how can solve this problem
great thanks for very quick answer .

推荐答案

不,我打赌一个表格不是另一个表格的孩子。亲子关系实际上已经不再适用于表格。您可以通过使用 Form.TopLevel (将实例属性指定为false)和设置父项来打破此限制,但它会在另一个表单中显示一个表单,有实际意义。很难相信你已经做到了;更有可能的是一种形式是主要的,另一种形式不是,也可能是另一种形式所拥有的,这通常非常有用。



关于你的问题 ,你只需要创建一个漂亮的布局。你没有证明你做了什么,所以我们看不出有什么不对。我不认为你的观察结果是正确的。如果你的第二个表格真的最大化,你不会看到第一个表格上的按钮,但你根本看不到第一个表格。



主要解决方案对于这些问题,将设计从多种形式转变为一种形式。无论如何你只有一个屏幕。您以两种形式显示的内容总是可以放在一个中,但它的某些元素(通常是面板)可以隐藏和显示,可以临时更改大小,滑动等等。当一次只显示一个容器控件时,一个很好的解决方案是 TabControl 。有些控件应该在 TabControl 之外并且总是显示,有些可以放在标签页中并一次显示一个。它适合大多数简单的应用。可以创建像可停靠UI这样的大事,就像Visual Studio一样。还有很多其他解决方案;毕竟,您可以使用位置大小将任何表单移动到任何位置,和/或调整大小。物业。



-SA
No, I bet one form is not the child of another one. Parent-child relationship is effectively made defunct for forms. You could break this limitation by using Form.TopLevel (assign the instance property to false), and the setting the parent, but it would show one form inside another one, which hardly makes practical sense. It's hard to believe that you have done that; more likely that one form is main, and another is not, also one could be owned by another one, which is usually extremely useful.

As to your "problem", you just need to create a nice layout. You haven't demonstrate what you have done, so we cannot see what's wrong. I don' think your observations are described correctly. If your second form was really maximized, you would not see not only the button on first form, but you would not see the first form at all.

The main solution for such problems is changing design from multiple forms to just one form. You have only one screen anyway. What you have shown in two form can always fit in one, but some elements of it (very typically, panels) can hide and show, can temporary change size, slide away, and so on. One good solution when only one container control is shown at a time is TabControl. Some controls should be outside of TabControl and always shown, some can be placed in tab pages and shown one at a time. It fits most of simple application. It's possible to create such a big thing as the dockable UI, pretty much as the one of Visual Studio. There are many other solutions; after all, you can simply move any form to any location, and/or resize it, using its Location and Size properties.

—SA


这篇关于在父母中完全显示儿童控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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