URGENTE!!! Panel1.Width := Form1.ClientWidth / 2; ?

Delphi

25/07/2003

Por favor, alguém me ajude a corrigir este código.

procedure TForm1.FormResize(Sender: TObject);
begin
  Panel1.Width := Form1.ClientWidth / 2;
end;


Obridado,

Roberto


Tenil

Tenil

Curtidas 0

Respostas

Mikemurussi

Mikemurussi

25/07/2003

Use:
Panel1.Width := Trunc(Form1.ClientWidth / 2); ou
Panel1.Width := Form1.ClientWidth div 2;

Se dividir 3 por 2, o resultado não é um inteiro, e a propriedade Width é do tipo Integer, por isto seu problema. Trunc corta um número pegando somente a parte inteira e div divide pegando a parte inteira. Já mod retorna o resto da divisão.

[url]www.murussi.com.br[/url]


GOSTEI 0
Tenil

Tenil

25/07/2003

Valeu,

[]s

Roberto


GOSTEI 0
POSTAR