我有以下代码:

procedure TForm1.FormCreate(Sender: TObject);
var
  cpic: tcomponent;
  whichcol: integer; // have tried extended types
  whichrow: integer; // have tried extended types
begin
  for cpic in form1 do
  begin
    if (cpic.ClassType = timage) and (cpic.Tag = 10) then
    begin
      whichcol := timage(cpic).left - left div gap;
      whichrow := timage(cpic).Top - top div gap;
    end;
  end;
end;


这将导致以下错误:


错误

项目project1.exe引发了异常类“外部:SIGFPE”。


With:作为概述的错误:

whichcol := (timage(cpic).left - left) div gap;


方程式不应该只返回数字值吗?

最佳答案

SIGFPE =浮点错误。

听起来像被零除。您确定gap非零吗?

10-08 13:38