I have the following code:
procedure TForm1.FormCreate(Sender: TObject);
var
cpic: tcomponent;
whichcol: integer; // have tried extended types
whichrow: 开发者_如何学Gointeger; // 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;
This results in the following error:
Error
Project project1.exe raised exception class 'External: SIGFPE'.
With: as the outlined error:
whichcol := (timage(cpic).left - left) div gap;
Should the equation not just return a number value?
SIGFPE = Floating Point Error.
Sounds like a division by zero. You sure gap
is non-zero?
精彩评论