我有以下代码:
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;
这会导致以下错误:
错误
Project project1.exe引发了异常类'External:SIGFPE'。
使用:如概述的错误:
whichcol := (timage(cpic).left - left) div gap;
这个等式不应该只返回一个数值吗?
答案 0 :(得分:4)
SIGFPE =浮点错误。
听起来像是一个零除。您确定gap
不为零吗?