Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2004.05.30;
Скачать: 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 вся ветка

Текущий архив: 2004.05.30;
Скачать: CL | DM;

Наверх




Память: 0.46 MB
Время: 0.04 c
11-1073895003
mmn
2004-01-12 11:10
2004.05.30
Проблема с TKOLTabControl


11-1074337661
puky
2004-01-17 14:07
2004.05.30
DirectX in KOL


1-1084558378
Bulanov
2004-05-14 22:12
2004.05.30
Развернуть приложение


1-1084879995
MegaVolt
2004-05-18 15:33
2004.05.30
Как оформить информацию получаемую из файлов с разными форматами?


9-1074963842
-=DJ=-
2004-01-24 20:04
2004.05.30
НУЖЕН специалист (или хотя бы знающий) OpenGL в Delphi