/ z' x7 B$ c6 A, ^, T9 { 一.: a1 z8 G! z) k% { AnsiString nameString("TButton"); TButton * button; for(int i=0; i < ComponentCount; i++) {- R. j, `# y( _* A& L //Check to see if the component is a TButton/ d8 s% h; R; E' Z if (Components->ClassNameIs(nameString)) { //cast the component to a TButton *% S1 }3 U! M) C' L6 r, ~( @ button = (TButton *)Components;7 e' n, W- X- n6 A button->Font->Name = "Courier";, Q2 K. X. Z- @9 V8 I ......
+ e( U9 A6 y) K6 i, ^% P" x" ?$ m 二. 我想动态创建和静态创建都没有太大区别,只要它属于你的MainForm。( new TButton(this) ). 用一个需循环 TButton* button;8 ]5 g& s- m2 n! E; \0 M; s3 Q# w for(int i=0;i<MainForm->ComponentCount;i++){ if((button= dynamic_cast<TButton*>(MainForm->Components)) != NULL ) button->Caption="Button";7 k" J) B% \) L% B: y }5 `2 N9 T$ J! _$ X3 i
| 欢迎光临 数学建模社区-数学中国 (http://www.madio.net/) | Powered by Discuz! X2.5 |