How do I show marks on the progress bar?

I am loading a collection of files and I want to show the progress in a progress bar. Just show the overall progress by setting the max value of the progress bar to the total size of all files and setting the current position to the size downloaded so far.

What I would like to do is split the progress bar into segments, with each section representing a different file in the collection.

Is it possible? How should I do it?

+1


source to share


4 answers


If you know the total download size and know the total download size, then you can simply set the maximum total file size and .Position to the total downloaded so far. No need to worry about how the size is split between files.



Or did you mean you want to tick the progress bar according to the size of each file?

0


source


I think the easiest way is to make a UserControl, drop the ProgressBar on it, override the UserControl OnPaint () and paint your lines.



I think the UserControl will be a little easier to handle than drawing directly on the form. The coordinates are easier to handle and it would be easier to reuse it in another application.

+3


source


Set the maximum value to 100. Then for each file you upload, do 100 * (file_size / total_download_size) and add them together. When you add them together, set the value of the progress bar. Update the value every time the file finishes downloading.

0


source


You can use two progress bars for each file and one for the general one. Or if you want to check the boxes: a simple solution is to add some lines below or above this panel.

0


source







All Articles