s1=0为什么循环不执行下去,直接跳到到数第五行了? s1:=0;
s2:=0;
sall:=0;
y:=0;
for y:=0 to Image1.Picture.Height-1 do
begin
showmessage(inttostr(y));
for x:=0 to Image1.Picture.Height-1 do
begin
showmessage('rgbpoint1[x,y].r'+inttostr(rgbpoint1[x,y].r));
if rgbpoint1[x,y].r=248 then
begin
showmessage('s='+inttostr(s1));
**** if s1=0 then
begin
s1:=x;
sall:=sall+1;
end
else
s2:=x;
end
else
begin
if not(s1=0) and not(s2=0) and (sall>3) then
begin
for i:=s1 to s2 do
rgbpoint1[i,y].r:=0;
end
else
begin
s1:=0;
s2:=0;
sall:=0;
end;
end;
s1:=0;
s2:=0;
sall:=0;
end;
end;
s2:=0;
sall:=0;
y:=0;
for y:=0 to Image1.Picture.Height-1 do
begin
showmessage(inttostr(y));
for x:=0 to Image1.Picture.Height-1 do
begin
showmessage('rgbpoint1[x,y].r'+inttostr(rgbpoint1[x,y].r));
if rgbpoint1[x,y].r=248 then
begin
showmessage('s='+inttostr(s1));
**** if s1=0 then
begin
s1:=x;
sall:=sall+1;
end
else
s2:=x;
end
else
begin
if not(s1=0) and not(s2=0) and (sall>3) then
begin
for i:=s1 to s2 do
rgbpoint1[i,y].r:=0;
end
else
begin
s1:=0;
s2:=0;
sall:=0;
end;
end;
s1:=0;
s2:=0;
sall:=0;
end;
end;
begin
showmessage('s='+inttostr(s1));//这句话执行了没有??
**** if s1=0 then
begin
s1:=x;
sall:=sall+1;
end
else
s2:=x;
end
你要看有没有执行,可设置断点然后按f7单步执行
begin
showmessage('s='+inttostr(s1));
**** if s1=0 then
begin
s1:=x;
begin
showmessage(inttostr(y));
for x:=0 to Image1.Picture.Height-1 do
~~~~~~~这个是不是写错了,应该是width?