tempwidth, tempheight :Integer; 
if   (imgSingle.Picture.Width /240) >= (imgSingle.Picture.Height/320) then begin
               tempwidth := 240;
               tempheight := (320/imgSingle.Picture.Width/240);
               end;
为什么显示[Error] Main.pas(427): Incompatible types: 'Integer' and 'Extended' 啊 
哪里不对啊 郁闷

解决方案 »

  1.   

    if   (imgSingle.Picture.Width /240) >= (imgSingle.Picture.Height/320) then begin
                   tempwidth := 240;
                   tempheight := Round(320/imgSingle.Picture.Width/240);
                   end;
      

  2.   

    tempheight := (320/imgSingle.Picture.Width/240);
    就是这句有问题,=右边的结果是浮点型,左边定义的是整形变量无法付值
    建议 round 或者trunc一下,要不四舍五入,要不不要小数 具体写法如下:
    tempheight := trunc((320/imgSingle.Picture.Width/240));
    Or
    tempheight := round((320/imgSingle.Picture.Width/240));
      

  3.   

    a1:=(imgSingle.Picture.Width /240); a2:=(imgSingle.Picture.Height/320);定义:a1,a2为Extended 然后比较