BCB批量控件处理代码
BCB批量控件处理代码
/*
* 转载请带上此行: FreedomKnight_Duzhi E_mail:
*/
TControl *but[10];
TButton *but2;
AnsiString sName = "Button";
int nButNum;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button5Click(TObject *Sender)
{
int nConNum = ControlCount;
while( nConNum-- )
{
if( AnsiPos( sName, Controls[nConNum]->Name ) )
{
Memo1->Lines->Add( Controls[nConNum]->Name );
nButNum++;
but[nButNum] = Controls[nConNum];
}
}
for( int i = 1; i <= nButNum; i++ )
{
but2 = (TButton*)but[i];
but2->Caption = "批量处理";
}
}