图像缩略图变形的问题??? ( 积分: 100 )

  • 主题发起人 主题发起人 chao987
  • 开始时间 开始时间
C

chao987

Unregistered / Unconfirmed
GUEST, unregistred user!
用image.picture.loadfile请入图像后大图像会变形,请问有没有好的解决方法。
附自己想的但不知错在哪里?
mage1.Picture.loadfromfile(extractfilename(openpicturedialog1.FileName));
picturewidth:=image1.picture.width;
pictureheight:=image1.picture.height;
widthtimes:=picturewidth/220;
heighttimes:=pictureheight/185;
if widthtimes>=heighttimes then
smalltimes:=widthtimes else
smalltimes:=heighttimes;
image1.picture.width:=round(picturewidth/smalltimes);
image1.picture.height:=round(picturewidth/smalltimes);
image1.picture.left:=(220-image.showimage.width)div 2;
image1.picture.top:=(185-image.showimage.height)div 2;

编译提示image1.picture.width是只读不可写
 
用image.picture.loadfile请入图像后大图像会变形,请问有没有好的解决方法。
附自己想的但不知错在哪里?
mage1.Picture.loadfromfile(extractfilename(openpicturedialog1.FileName));
picturewidth:=image1.picture.width;
pictureheight:=image1.picture.height;
widthtimes:=picturewidth/220;
heighttimes:=pictureheight/185;
if widthtimes>=heighttimes then
smalltimes:=widthtimes else
smalltimes:=heighttimes;
image1.picture.width:=round(picturewidth/smalltimes);
image1.picture.height:=round(picturewidth/smalltimes);
image1.picture.left:=(220-image.showimage.width)div 2;
image1.picture.top:=(185-image.showimage.height)div 2;

编译提示image1.picture.width是只读不可写
 
Image1.AutoSize := false;
Image1.Stretch := false;
 
Image1.Stretch := true;

image1.Picture.loadfromfile(extractfilename(openpicturedialog1.FileName));


image1.height:=round(image1.picture.height*image1.width/image1.picture.width);

你试试看。!◎#¥◎!#%
 
image1.picture.height是不可以改变的能变的是image1.height
改掉就可以了
 
多人接受答案了。
 
后退
顶部