如何删除控件 [英] how to remove controls
本文介绍了如何删除控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在Windows窗体应用程序中从面板中删除控件。我有动态创建的组合框,文本框和按钮我想从同一行的面板中删除这三个控件。但只删除了按钮。我想删除同一行中的控件。在面板中有更多控件。控件应该一次一行地删除。
i want to remove controls from panel in windows form application. i have the dynamic created combobox,Textbox, and button i want to delete these three controls from panel which is in the same row. but only button is remove. i want to delete controls which is in the same row. in the panel many more controls. controls should be delete row by row not all at a time.
推荐答案
你好,
如果有的话是一个示例代码,写一个更有用的答案会更容易。我希望以下内容对您需要的内容有意义
在这些项目中添加一个GroupBox或您选择的其他容器。
Hello,
If there were a sample code, it would be easier to write a more useful answer. I hope the following makes sense to what you need
Add a GroupBox or some other container of your choice to those items.
//For each control in this container's list of controls
foreach (Control control in aContainer.Controls)
{
aContainer.Controls.Remove(control);
}
这应该可以帮助你只删除你想要的控件。
问候
This should help you to remove only the controls you want.
Regards
这篇关于如何删除控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文