Главная страница
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.024 c
14-1083889805
Думкин
2004-05-07 04:30
2004.05.30
С днем рождения! 7 мая


4-1082357392
Сергей_И
2004-04-19 10:49
2004.05.30
CreateProcess проблема в получении handle


6-1081432580
Lena19
2004-04-08 17:56
2004.05.30
предача динамического массива через сокет


3-1083829796
}|{yk
2004-05-06 11:49
2004.05.30
Оптимизация процедуры построения дерева в FireBird 1.5


14-1084450666
RealRascal
2004-05-13 16:17
2004.05.30
Загадка.