|
Ideas -
C++ Builder
|
Este Ejemplo muestra como crear un boton y como luego eliminarlo todo en tiempo de ejecucion. Como ejemplo, ponemos unos botones de prueba, en concreto 5 TButtons, de esta forma:
for (int i=1;i<=5;i++)
{
TButton *boton=new TButton(this);
boton->Parent=this;
boton->Name="b"+ IntToStr(i);
boton->Caption="Boton "+IntToStr(i);
boton->Width=100;
boton->Top=50+30*i;
boton->Left=50;
}
y para eliminar el botón deseado
TButton * button;
for(int i=0; i < ComponentCount; i++)
if (Components[i]->ClassNameIs( "TButton" )) {
button = (TButton *)Components[i];
if ( button->Name=="b3" ) delete button;
}
|