S
sdralf
Unregistered / Unconfirmed
GUEST, unregistred user!
这个问题其实应该很简单的~可小弟写的代码就是实现不了~调试通过可是没有作用~大家帮小弟看看代码错在哪儿了~谢谢谢谢~
小弟原意是只要用updown1修改image1.height,让image1.width随着image1.height的增加而增加,随着减少而减少,同时将proportional定为true,这样应该就可以简单的实现图片按比例缩放了
代码如下:
//Form1中放image1,edit1,updown1
//updown1的associte指定edit1
//image1事先调入图片
procedure TForm1.UpDown5Changing(Sender: TObject;
var AllowChange: Boolean);
begin
image1.Proportional:=true;//需要保持image1.picture的比例
image1.height:=strtoint(edit1.Text);
with image1 do
if image1.Height=image1.Height+1 then image1.Width:=image1.Width+1
else if image1.Height=image1.Height-1 then image1.Width:=image1.Width-1;
end;
为什么调试通过~但在用的时候~还是只能变化image1.height而不能变image1.width~这样导致一旦image1.width达到了原来的数值~不管height怎么拉长~图片都不会再放大了~这是怎么回事啊?
小弟原意是只要用updown1修改image1.height,让image1.width随着image1.height的增加而增加,随着减少而减少,同时将proportional定为true,这样应该就可以简单的实现图片按比例缩放了
代码如下:
//Form1中放image1,edit1,updown1
//updown1的associte指定edit1
//image1事先调入图片
procedure TForm1.UpDown5Changing(Sender: TObject;
var AllowChange: Boolean);
begin
image1.Proportional:=true;//需要保持image1.picture的比例
image1.height:=strtoint(edit1.Text);
with image1 do
if image1.Height=image1.Height+1 then image1.Width:=image1.Width+1
else if image1.Height=image1.Height-1 then image1.Width:=image1.Width-1;
end;
为什么调试通过~但在用的时候~还是只能变化image1.height而不能变image1.width~这样导致一旦image1.width达到了原来的数值~不管height怎么拉长~图片都不会再放大了~这是怎么回事啊?