Except for the basic things you have to do to zip or unzip a file, the only extra thing you have to do to add a progress bar for the zip or unzip (or other) operation is to write a handler for GlobalStatus event which sets the "percentage" property of your progress bar. The GlobalStatus event provides you with status information on the entire zipping or unzipping operation, and one of the pieces of information it provides is the completion status, ranging from 0 to 100%. If you want to know the status of the operation on a file-by-file basis, use the FileStatus event instead.
VB.NET | Copy Code |
---|---|
MyProgressbar.value = nBytesPercent |
Delphi | Copy Code |
---|---|
ProgressBar1.Position := nBytesPercent; |
The progress bar will then go from 0 to 100% as the zipping or unzipping is performed. You can reset it back to 0 after the library returns a result code from the zip or unzip method. The code is easy:
Visual Basic | Copy Code |
---|---|
MyProgressbar.value = 0 |
That's it. Of course, you can do a lot more, so we do suggest you read the GlobalStatus property's help topic.