Winform控件的动态删除请参考Winform控件动态删除

List<Button> listButton = new List<Button>();
foreach (var control in wrapPanelContainer.Children)
{
if(!(control is Button))
continue;

var button = control as Button;

if (!button.Name.Contains(“BtnTable”))
continue;

listButton.Add(button);
}

foreach (Button control in listButton)
wrapPanelContainer.Children.Remove(control);

————————————————
版权声明:本文为CSDN博主「那人_那事」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/u014786187/article/details/104013741