我們可以透過 ComponentCount 來掃瞄 Form 底下的所有元件,進而控制這些元件,例如底下這個 sample code 可以把 Form
底下的 Edit 元件一口氣改掉。
Example:
for (int i = 0; i < ComponentCount; ++i)
{
if (Components[i]->ClassNameIs(“TEdit”))
((TEdit *)Components[i])->Text = “我被改了”;
}
那若是要改某個元件底下的子元件呢? 例如要改 GroupBox 裡頭的所有 Label 要怎辦呢? 這時就要用到 ControlCount 了。 繼續閱讀 »
Archive for the ‘C/C++’ Category
十二月
15
2009