删除动态增加的按钮
在对话框中,通过for循环动态增加了几百个按钮,相关代码如下,动态增加后再想删除他们,该怎么操作作呢?
for(int i=0;i<15;i++)
for(int j=0;j<15;j++)
{
pNewButton = new CButton();
CRect rcButton(50*i, 30*(j+4), 50*(i+1), 30*(j+5)); // 按钮在对话框中的位置。
CString str;
str.Format("%d",i*10+j);
pNewButton->Create(str, 0, rcButton, this, 10000+i*10+j);
pNewButton->ShowWindow(SW_SHOW);
//pNewButton->DestroyWindow();
}