Главная страница
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.021 c
4-1081846401
Jack1982
2004-04-13 12:53
2004.05.30
Процессы в Win2k и XP


8-1078934561
Александр1
2004-03-10 19:02
2004.05.30
Исчезающий Image


7-1082635985
ashnurov
2004-04-22 16:13
2004.05.30
Bios


7-1083135454
vitalyIshim
2004-04-28 10:57
2004.05.30
Температура процессора и скорость вращения куллера


1-1084776050
Coca
2004-05-17 10:40
2004.05.30
3х мерная графика в Delphi