今天遇到一个奇怪的问题,在WinForm内动态添加Button后再动态的移除,发生稀奇古怪的现象,Button控件只被规律的移除,没有完全移除 foreach (Control c in this.Controls) { if (c is Button && ((Button)c).ForeColor == Color.White) { this.Controls.Remove(c); c.Dispose(); } if (c is Label && c.Tag != nu
for (int i = 0; i < 4; i++) { Button btn = new Button(); //btn.Name = dt.Rows[i]["ANDON_CONTENT_CODE"].ToString(); btn.Text = dt.Rows[i]["ANDON_CONTENT_NAME"].ToString(); btn.Location = new Point(5 + i * 143, 25); btn.Size = new Siz