Delphi: Redimesionar form child em MDI

0

Posted on : 19-07-2009 | By : Paulo H Oliveira | In : Delphi

Esta rotina redimensiona o formulário Child de uma aplicação MDI para preencher todo a área do form pai.

procedure TForm1.SetBounds(ALeft, ATop, AWidth,
AHeight: Integer);
var
MainForm: TForm;
Rect: TRect;
//OurWidth: Integer;
//OurHeight: Integer;
begin
if Showing then begin
MainForm := Application.MainForm;
// Obtem o retângulo da área cliente MDI
Windows.GetWindowRect(MainForm.ClientHandle, Rect);
// Calcular largura e altura da área cliente
//OurWidth := Rect.Right – Rect.Left;
//OurHeight := Rect.Bottom – Rect.Top;
// Calcula a nova posição
//ALeft := (OurWidth – Width) div 2;
//ATop := (OurHeight – Height) div 2;
end;
inherited SetBounds(0, 0, Rect.Right-Rect.Left-5, Rect.Bottom-Rect.Top-5);
//inherited SetBounds(ALeft, ATop, AWidth, AHeight);
end;

procedure TForm1.SetBounds(ALeft, ATop, AWidth,

AHeight: Integer);

var

MainForm: TForm;

Rect: TRect;

//OurWidth: Integer;

//OurHeight: Integer;

begin

if Showing then begin

MainForm := Application.MainForm;

// Obtem o retângulo da área cliente MDI

Windows.GetWindowRect(MainForm.ClientHandle, Rect);

// Calcular largura e altura da área cliente

//OurWidth := Rect.Right – Rect.Left;

//OurHeight := Rect.Bottom – Rect.Top;

// Calcula a nova posição

//ALeft := (OurWidth – Width) div 2;

//ATop := (OurHeight – Height) div 2;

end;

inherited SetBounds(0, 0, Rect.Right-Rect.Left-5, Rect.Bottom-Rect.Top-5);

//inherited SetBounds(ALeft, ATop, AWidth, AHeight);

end;

Compartilhe :

  • Stumble upon
  • twitter

Escreva um comentário