Вниз
Скачать: CL | DM;

Пропорциональный размер картинки как в PhotoShop   Найти похожие ветки 

 
IrviS ©   (2004-03-23 13:33) [0]

Как-то криво все работет:

procedure TfrmResize.Edit1Change(Sender: TObject);
var NewHeight, NewWidth :Integer;
begin
 if CheckBox1.Checked then
   begin
     NewHeight := StrToInt (Edit1.Text);
     NewWidth := StrToInt (Edit2.Text);
     try
       NewWidth := (ValueWidth * NewHeight) div ValueHeight;
     except
       NewWidth := ValueWidth;
       end;
     Edit1.Text := IntToStr (NewHeight);
     Edit2.Text := IntToStr (NewWidth);
   end;
end;

procedure TfrmResize.Edit2Change(Sender: TObject);
var NewHeight, NewWidth :Integer;
begin
 if CheckBox1.Checked then
   begin
     NewHeight := StrToInt (Edit1.Text);
     NewWidth := StrToInt (Edit2.Text);
     try
       NewHeight := (ValueHeight * NewWidth) div ValueWidth;
     except
       NewHeight := ValueHeight;
       end;
     Edit1.Text := IntToStr (NewHeight);
     Edit2.Text := IntToStr (NewWidth);
   end;
end;


 
Думкин ©   (2004-03-24 07:08) [1]

Edit1.Text := IntToStr (NewHeight);
Edit2.Text := IntToStr (NewWidth);


Данный код изменяет содержимое - вновь вызываются процедуры и т.д. Поэтому и криво.
Пусть соотношение высоты и ширины 1:2.
Вводим ширину 7, в итоге там будет четное число - 6.



Страницы: 1 вся ветка

Скачать: CL | DM;



Память: 0.45 MB
Время: 0.021 c
7-1081885251
KyRo
2004-04-13 23:40
2004.05.30
Как добится что бы программа работала на нескольких ОС


14-1084456596
Developerr
2004-05-13 17:56
2004.05.30
Как получить только имя файла в OpenDialog?


1-1084538505
Fishka
2004-05-14 16:41
2004.05.30
ComboBox и свой Hint для каждого Item


14-1083861937
Мазут Береговой
2004-05-06 20:45
2004.05.30
Как определить качество (вредность) дисплея?


7-1082731841
Andrew999
2004-04-23 18:50
2004.05.30
Как узнать сколько времени включен компьютер




   Наверх