Вниз
Скачать: 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.023 c
3-1084257796
Alex_xxx
2004-05-11 10:43
2004.05.30
ADO, BDE, FOX, dBASE: КОДИРОВКА ДОС/ВИН


3-1084185491
Viktor
2004-05-10 14:38
2004.05.30
Конфликт транзакций


1-1084606165
Alek_1
2004-05-15 11:29
2004.05.30
Форма в Dll


1-1084980494
dimon_programmer
2004-05-19 19:28
2004.05.30
Как правильно УНИЧТОЖИТЬ MDI-форму?


14-1083998971
Mamed
2004-05-08 10:49
2004.05.30
Sound tuk tuk




   Наверх