Вниз
Скачать: 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.44 MB
Время: 0.021 c
3-1083609732
Mike(c)
2004-05-03 22:42
2004.05.30
Давно затертая тема про поиск в TTable... ПОМОГИТЕ ПЛИЗ!!!


3-1083683677
Мунька
2004-05-04 19:14
2004.05.30
Проблема в ADO


14-1084350738
xman
2004-05-12 12:32
2004.05.30
Install Shield EXPRESS


7-1082965653
Master Paleva
2004-04-26 11:47
2004.05.30
Ctrl+Alt+Delete


6-1081419374
-=Demon=-
2004-04-08 14:16
2004.05.30
Контрольная Сумма




   Наверх