可能重复:
如何显示进度条?
我创建了一个 steganalisys 应用程序,我想添加一个进度条来显示该过程的工作时间。
procedure TForm2.Button2Click(Sender: TObject);
var
q,x,y,leastSigBit,currentPixel,newPixelValue: integer;
pixels: PByteArray;
bmp: TBitmap;
begin
memo1.lines.clear;
Image2.Picture.Assign(Image1.Picture.Bitmap);
bmp := Image2.Picture.Bitmap;
for y := 0 to bmp.Height-1 do
begin
pixels := bmp.ScanLine[y];
for x := 0 to bmp.Width-1 do
begin
currentPixel := pixels[x];
leastSigBit := getBit(currentPixel, 0);
newPixelValue:=setBit(newPixelValue ,7,leastSigBit);
newPixelValue:=setBit(newPixelValue ,6,leastSigBit);
newPixelValue:=setBit(newPixelValue ,5,leastSigBit);
newPixelValue:=setBit(newPixelValue ,4,leastSigBit);
newPixelValue:=setBit(newPixelValue ,3,leastSigBit);
newPixelValue:=setBit(newPixelValue ,2,leastSigBit);
newPixelValue:=setBit(newPixelValue ,1,leastSigBit);
newPixelValue:=setBit(newPixelValue ,0,leastSigBit);
end;
pixels[x] := newPixelValue;
memo1.lines.append('pixel ke ' + inttostr(x) + ',' + inttostr(y) + ' desimal ' + inttostr(currentPixel) + ' (biner ' + toBinary(currentPixel) + ') ' +
' desimal baru ' + inttostr(newPixelValue) + ' (biner ' + toBinary(newPixelValue) + ')');
end;
end;
memo1.lines.append('All done!');
Button4.Enabled:=True;
Button2.Enabled:=False;
Button1.Enabled:=False;
Button5.Enabled:=True;
end;
如何为该过程制作进度条?我必须把命令进度条放在哪里?