I have one progressbar and an image on my form. Now I am doing some processing on each scanline on image. I wanted to show progress of my process using progressbar. I set the following properties of progressbar :
Max = 20
Min = 0
Position = 0
Step = 1
Smooth = False
Now my code on buttonclick event is as under :
stat := imgmain.Picture.Bitmap.Height div pbImage.Max;
Curstatus := 0;
for cnt := 0 to img.Picture.Bitmap.Height - 1 do begin
for cnt1 := 0 to img.Picture.Bitmap.Width - 1 do begin
//Some processing
end;
if cnt > (Curstatus + stat) then begin
pgimg.StepIt;
Curstatus := cnt + stat;
end;
end;
My problem is when I run this code, the if block is executed exactly 20 times but it shows more than 20 steps on my progress bar. Also the last step is shown incomplete. Note that smooth
property is set to false.