Вниз
Скачать: 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.024 c
4-1081323245
juiceman
2004-04-07 11:34
2004.05.30
Как узнать "хуковое") окно ???


1-1084969078
Alex_x
2004-05-19 16:17
2004.05.30
DBLookupComboBox1


8-1079855312
BenderLog
2004-03-21 10:48
2004.05.30
Как уменьшить размер графического файла?


14-1083939526
ИМХО
2004-05-07 18:18
2004.05.30
Что лучше: узкий специалист или дилетант с "широким" кругозором?


14-1084425781
Мазут Береговой
2004-05-13 09:23
2004.05.30
Ужасные новости для тех, кто собирается долго жить!




   Наверх