清除Windows表格 [英] clearing windows forms

查看:104
本文介绍了清除Windows表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用c#创建了一个窗口表单.现在我面临的问题是我无法清除表格.
例如,假设我的表单最初由一个文本框和一个提交按钮组成.接下来是什么
我想做的是,当用户输入文本并按下提交按钮时.我希望清除文本框和提交按钮,而要删除另一个包含要创建的文本的按钮.
有可能这样做吗?如果是,我必须使用什么功能?

i have created a window form using c#. now the issue that i am facing is that i cannot clear the form.
for instance suppose that my form initially consists of a text box and a submit button. next what
i want to do is that hen the user types a text and presses the submit button. i want the text box and submit button to get cleared and instead another button containing the text submitted to be created.
is it possible to do so? if yes what functions do i have to make use of?

推荐答案

如果您想要其他表单,请创建另一个表单并从第一个表单中显示它.

如果需要向导,则在内容的主窗体内放置一个面板.在该面板中,为当前页面动态添加用户控件.当需要显示下一页时,从面板上删除现有的用户控件,然后为下一页添加用户控件.

如果这对您来说太复杂了,请使用选项卡控件代替,其中每个选项卡都代表一个页面或查找第三方选项卡控件/向导组件.

对于非常简单的情况,您也可以将所有控件都放在表单上并调整控件的可见性.

可以将其与布局容器(流布局或表布局)结合使用,以使其更容易设计,就像您在设计时看到的所有控件一样.如果为此目的使用了表格布局,则应自动调整包含要隐藏项目的行或列的大小.
If you want another form, then create another form and show it from the first form.

If you need a wizard, then put a panel inside the main form for the content. In that panel, dynamically add an user control for the current page. When the next page need to be displayed remove the existing user control from the panel and add a user control for the next page.

If this is too complicate for you, then uses a tab control instead where each tab represent a page or find a third party tab control/wizard component.

For very simple cases, you might also simply put all controls on the form and adjust the visibility of controls.

This could be combined with layout containers (flow layout or table layout) to make it easier to design it as you would see all controls at design. If table layout is used for that purpose the rows or columns containing items to hide should be autosized.


感谢您的回复朋友.我找到了解决方案.
philippe我不想再做任何新形式.和textbox.clear仅适用于文本框.我需要从表单中删除所有对象.
为此,我使用了不同对象的数组来说明它们.后来我用Controls.Remove()删除了元素.

谢谢.
Thank you for the replies friend. i have found the solution.
philippe i do not want to make any more new forms. and textbox.clear works for only text boxes. i needed to remove all objects from a form.
to do so i used arrays of different objects to keep account of them. later i used Controls.Remove() to remove elements.

thank you.


TexBox.Clear有什么问题?难以查看其帮助 http://msdn.microsoft.com/zh-我们/library/system.windows.forms.textbox.aspx [ ^ ]?

许多其他控件都具有类似的功能,但是对于按钮来说,这是荒谬的.

—SA
What''s wrong with TexBox.Clear? Difficult to look at its help http://msdn.microsoft.com/en-us/library/system.windows.forms.textbox.aspx[^]?

Many other controls have something like that, but for a button is sounds absurd.

—SA


这篇关于清除Windows表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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