Just put all the "work" code in the OnWork Event.
and put progressbar code here:
procedure TForm1.BackgroundWorker1WorkProgress(Worker: TBackgroundWorker; PercentDone: Integer);
begin
ProgressBar1.Position := PercentDone;
end;
Also show working code. ImageEnView1.CopyObjectsToBack(true); is incorrect because ImageEnView1 can not contain objects and what do you do with the memory stream?
In any event make sure by repeated testing that the code you process the image with works flawlessly outside of the thread. If it does bot function perfectly once you put the work in a thread the thread will fail. You may also be able to just use this but you will have to test it:
procedure TForm1.ImageEnVect1FinishWork(Sender: TObject);
begin
ProgressBar1.Position := 0;
end;
procedure TForm1.ImageEnVect1Progress(Sender: TObject; per: Integer);
begin
ProgressBar1.Position := per;
end;
When testing the processing the image in a thread sometimes it is best to do the final tests outside of the IDE by running the EXE all by itself.
If you send me your email address I'll send you a demo of Backgroundworker with ImageEn Demo. I had to modify your processing code as yours would not compile.
William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html