|
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
TForm *f;
TLabel *l;
TButton *b;
int ct=0;
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Timer1->Interval=100;
ct=0;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button(TObject *Sender)
{
f->Tile();
f->Close();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
f=new TForm(this);
l=new TLabel(this);
b=new TButton(this);
f->Top=random(800);
f->Left=random(1000);
f->Width=169;
f->Height=128;
f->Caption=IntToStr(ct);
l->Caption="사랑해♡";
l->Width=57;
l->Left=16;
l->Height=13;
l->Top=24;
l->Parent=f;
b->Caption="확인";
b->Parent=f;
b->Left=48;
b->Top=56;
b->Left=48;
b->OnClick=Button;
f->Show();
ct++;
if (ct == 100)
{
Timer1->Interval=0;
}
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TButton *Button1;
TLabel *Label1;
TTimer *Timer1;
void __fastcall Button1Click(TObject *Sender);
void __fastcall Timer1Timer(TObject *Sender);
private: // User declarations
public: // User declarations
__fastcall TForm1(TComponent* Owner);
void __fastcall Button(TObject *Sender);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
어떻게 하면 동적 생성된 100개의 폼중에
버튼을 누른 해당 폼을 죽일수 있을까요??
잘 안되네요
무슨 컴포넌트가 특별히 있는것도 아닌거 같은데
빠른 답변 부탁드립니다.ㅠㅠㅠ
|