Ir para conteúdo
Fórum Script Brasil
  • 0

(Resolvido) Redimencionar oa formulários


António44

Pergunta

Amigos estou usando esta Unit para redimencionar os formulário principalmente a form Principal,o que acontece é que aparece os Panel aumentados mas os SpeedButton não altera se tenho Labels tambem ficam mal e Bevel tambem não acompanha o form imagem tb não...alguêm tem alguma ideia que possa ajudar.

Abraço

unit sCtrlResize;

interface
uses
StdCtrls,
Controls,
Forms
;

procedure CtrlResize(var Sender: TForm); export;

implementation

procedure CtrlResize(var Sender: TForm);

const
iWidth = 1280;
iHeight = 800;

var i : Integer;

begin
with Sender do
for i := 0 to ComponentCount -1 do
begin { aqui era suposto varrer todos os componentes do form que possam ser redefinidos (classe TWinControl) }
if Components[i] is TWinControl then
begin { Redefine os componentes em proporção ao original }
TWinControl(Components[i]).Width := Round(TWinControl(Components[i]).Width * (Screen.Width / iWidth));
TWinControl(Components[i]).Height := Round(TWinControl(Components[i]).Height * (Screen.Height / iHeight));
TWinControl(Components[i]).Left := Round(TWinControl(Components[i]).Left * (Screen.Width / iWidth));
TWinControl(Components[i]).Top := Round(TWinControl(Components[i]).Top * (Screen.Height / iHeight));
end
else
if Components[i] is TLabel then
begin { Redefine os componentes em proporção ao original }
TLabel(Components[i]).Width := Canvas.TextWidth(TLabel(Components[i]).Caption); // Round(TWinControl(Components[i]).Width * (Screen.Width / iWidth));
TLabel(Components[i]).Height := Canvas.TextHeight(TLabel(Components[i]).Caption); // Round(TWinControl(Components[i]).Height * (Screen.Height / iHeight));
TLabel(Components[i]).Left := Round(TWinControl(Components[i]).Left * (Screen.Width / iWidth));
TLabel(Components[i]).Top := Round(TWinControl(Components[i]).Top * (Screen.Height / iHeight));
end;
end;

//Para não alterar o tamanho e posição do form já tentei de varias maneiras mas quando rodo em 1280 por 960 dá buraco
(*
{ Redefine o Formulário }
Sender.Width := Round(Sender.Width * (Screen.Width / iWidth));
Sender.Height := Round(Sender.Height * (Screen.Height / iHeight));
Sender.Top := Round(Sender.Top * (Screen.Height / iHeight));
Sender.Left := Round(Sender.Left * (Screen.Width / iWidth));
*)

{ Altera o tamanho da Fonte do Formulário????????? }
Sender.Font.Size := Round(Sender.Font.Size * (Screen.Height / iHeight));
end;


end.
{*


procedure TfrmCadEmpresas.FormShow(Sender: TObject);
begin
sCtrlResize.CtrlResize(TForm(frmEmpresas));
end;

*}

Link para o comentário
Compartilhar em outros sites

2 respostass a esta questão

Posts Recomendados

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,1k
    • Posts
      651,8k
×
×
  • Criar Novo...