The original control was not written to include thread-safety compliance. That has been corrected and is available in the new download(s).
Thanks to everyone for all the very kind words!
As an application developer, it is not uncommon to run into a specific UI requirement that you cannot fulfill by using a purchased control. Often times you'll find 3rd party controls that come close but don't quite get you to your goal. Your options are to alter the UI Design for this particular requirement, or write your own control.
That's the origin of this control. My application was performing a rather lengthy database update that involved a large group of parent objects and with each parent object, a large number of child-objects needed to be updated as well. The entire process would take 30 seconds to several minutes and I didn't want my users staring at an hourglass for that period of time wondering if they'd locked up.
I started out with a standard Progress Bar which was fine until I noticed several 'ticks' were so lengthy that again my concern went back to the users and not wanting to force them to sit staring at a screen that was dead for a more than a few seconds.
To solve this problem, I could have just stacked two progress bars on top of each other and updated them individually — but being a programmer, I could find no valid reason not to over-engineer this task into a single, self-contained control!
Using the Control in your Project
While in Visual Studio, right-click on the Toolbox in the Tab you wish to add the Control. Click 'Choose Items...' and navigate to where you saved the SplitProgressBar.dll. Select the DLL and click 'OK'.
This will add the control to your toolbox and you're now ready to drag it onto your forms for use.
BarBackColor is the background color of the panel behind the
BorderColor is color used in the lines surrounding the
TextBackColor is the background color of the panel behind the
TextColor is the
BarBottomColor and BarTopColor are the colors to use for the
BarBottom.BarMax is the upper limit that
.BarValue can reach.
BarBottom.BarMin is the lower limit that
.BarValue can reach.
BarBottom.BarStep tells the progress bar how to increment
.BarValue every time
.PerformBottomStep is pushed.
BarBottom.BarValue is the actual value of our
BarTop is identical to
true, the control will attempt to fill in the cells using a gradient pattern.
true, the control will ignore the
BarBottom values and draw one, large solid cell using the
PanelText.TextLabel is the Text displayed in the
PanelText.TextPanelAlignment Left, Center or Right horizontal alignment used for the Label.
true, the width of the
Label Panel will be calculated based on the text.
PanelText.TextPanelWidth use this to adjust the size of your
*Only valid if
TextPanelAutosize = False*.
Private Sub ProcessSomething()
.SyncTopAndBottom = True
.GradientBars = True
.BarTop.BarMax = ElementsToProcess.Count
.BarTop.BarStep = 50
.BarTop.BarValue = 0
Dim CurrentElement As Integer
For Each Element As SomeElement In ElementsToProcess
CurrentElement += 1
If CurrentElement Mod ProgBar.BarTop.BarStep = 0 Then
Using both the top and bottom bars at the same time is very simple: just set
.SyncTopAndBottom=False and setup your
.BarBottom properties the same way you setup the
*Note*: If your control height results in cells that are smaller than 6 pixels, a solid color will be used to fill in the cells regardless of your
Cool ComponentModel Properties
Have you ever had one property alter the value of another property during design time? To get the properties window for the control to refresh the values, use the
RefreshProperties to force the update like this:
Public Property BarMin() As Integer
Set(ByVal value As Integer)
If _Min <> value Then
_Min = value
If _Min > _Max Then Me.BarMax = _Min
Ever want to "hide" unused properties? Not all of them are "hidable" but for those that are, try this:
Public Overrides Property Autosize() As Boolean
Set(ByVal value As Boolean)
MyBase.AutoSize = value
Points of Interest
This is the first control I wrote that uses expandable properties (like
Location, etc.) While very nice to have, figuring out how to set the properties up like this caused me a number of heartaches not the least of which is there's almost no documentation on how to create, configure or use expandable properties (that I was able to find!)
A weirdness that happens quite frequently and I have yet to figure out why: When the control is first placed on your form, click on the control and scroll the properties window down to
BarBottom and look at the value displayed: "0,0,0,0" which are the default startup settings.
If you modify the Converter and rebuild the
SplitProgressBar class — instead of seeing the Sub-Property values, you'll see the NAME of the class like this, "
At this point, you have to remove
SplitProgressBar from the main project's reference list — and re-add it. Restarting Visual Studio will resolve this issue as well but since I was never intending the developer to change the sub-properties as a single line of comma-delimited text by filling in the parent property, I'm actually OK when this happens.
In fact, that's one improvement I'd like to make for the control: I would like NO text be displayed next to the parent property when collapsed. If anyone knows how to pull this off, PLEASE let me know!