1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
// la classe de ta fenêtre enfant se nomme TMdichild
//le .h
class TMDIChild : public TForm
{
__published:
// tes composants
void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
private:
public:
virtual __fastcall TMDIChild(TComponent *Owner);
};
//le .cpp
//---------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "ChildWin.h"
//---------------------------------------------------------------------
#pragma resource "*.dfm"
//---------------------------------------------------------------------
__fastcall TMDIChild::TMDIChild(TComponent *Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------
void __fastcall TMDIChild::FormClose(TObject *Sender, TCloseAction &Action)
{
Action = caFree;
}
//---------------------------------------------------------------------
// création depuis la form Principale <fsMDIForm>
TMdichild*Child;
//--- crée une nouvelle fenêtre MDI enfant ----
Child = new TMDIChild(Application);
// on donne un nom à la fenêtre
Child->Caption = Name; |