procedure TForm1.ToolButton2Click(Sender: TObject);
begin
if form1.MDIChildCount>0 then
begin
(form1.ActiveMDIChild as Tform2).fullscreen(true);
end;
end;
type
TForm2 = class(TForm)
RichEdit1: TRichEdit;
procedure FormResize(Sender: TObject);
private
{ Private declarations }
public
procedure FullScreen(full:boolean);
{ Public declarations }
end;
var
Form2: TForm2;
wState:TWindowState;
Resized:boolean=false;
implementation
{$R *.DFM}
procedure TForm2.FullScreen(full:boolean);
begin
if full then
begin
wState:=WindowState;
FormStyle:=fsNormal;
WindowState:=wsMaximized;
Resized:=true;
end else
begin
Resized:=false;
FormStyle:=fsMDIChild;
WindowState:=wState;
end;
end;
procedure TForm2.FormResize(Sender: TObject);
begin
if resized then
begin
fullScreen(false);
end;
end;