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;

解决方案 »

  1.   

    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
      

  2.   

    Image1.Picture.Height这个好像不是整数,不知道是不是这个影响。
    你要看有没有执行,可设置断点然后按f7单步执行
      

  3.   

    请问下面的判断条件是否满足,是不是没有执行  if s1=0 then 这个分支呀 if rgbpoint1[x,y].r=248 then
             begin
                showmessage('s='+inttostr(s1));
    ****        if s1=0 then
                begin
                    s1:=x;
      

  4.   

    for y:=0 to Image1.Picture.Height-1 do
       begin
         showmessage(inttostr(y));
         for x:=0 to Image1.Picture.Height-1 do
                                   ~~~~~~~这个是不是写错了,应该是width?