|
안녕들 하세요. ^^
다름이 아니라, 동적으로 컴퍼넌트를 생성하려면, 일일이 위치 등등의 속성을 나열해야되서,
그냥 정적으로 컴퍼넌트를 만들고, 헤더에 동적으로 잡아 놓고 대입한 후, 콘트롤 하려 하는데요..
프로그램을 실행시키고 몇시간이 지나면, 느려지다 out of resource가 나타나서요.
즉, 가정하자면,
헤더에
//---------------------------------------------------------------------------
class TAutoForm : public TForm
{
__published: // IDE-managed Components
.
.
.
.
TLabel *mTestLabel0;
TLabel *mTestLabel1;
TLabel *mTestLabel2;
.
.
.
TLabel *mTestLabel98;
TLabel *mTestLabel99;
.
.
.
.
public: // User declarations
TLabel *DTestLabel[100];
.
.
소스에서 FormCreate 이벤트에 ,
{
DTestLabel[0] = mTestLabel0;
DTestLabel[0] = mTestLabel1;
DTestLabel[0] = mTestLabel2;
.
.
DTestLabel[98] = mTestLabel98;
DTestLabel[99] = mTestLabel99;
}
이렇게 대입한 후,
다른데서 사용할 때는
for (int i = 0; i < 100; i++)
{
DTestLabel[i]->Caption = "TEST" + FormatFloat("0", i);
}
이런식으로 사용합니다.
물론, 실제로 저렇게 무식하게 사용하지는 않죠. (컴퍼넌트 종류도 다양합니다. ^^)
이렇게 사용하는 방법이 문제가 될 소지가 있나요?
답변 좀 꼭 부탁드릴께요.
}
|