There are a number of free example custom controls around the internet that are easy to add to an AdvancedHMI solution. One example can be found here:
https://code.msdn.microsoft.com/Custom-Colored-ProgressBar-a68b61de/view/ReviewsTo add this to your AdvancedHMI project follow these steps:
1) Right click the PurchasedControls folder in the AdvancedHMIControl project in Solution Explorer
2) Select Add Class
3) Give it the name ProgressBarEx
4) Delete the two lines of code
5) Copy all of the code from the web link above and paste into the new class
At this point you can Build the project and you should get a ProgressBarEx in your Toolbox. The ProgressBarEx is now a simple windows form control. We now need to make this into an AdvancedHMI control.
1) In the Controls folder of the AdvancedHMIControls project in Solution Explorer, right click BarLevel and select Copy
2) Right click the Controls folder and select paste
3) Right click the new file (Copy of BarLevel.vb) and select rename
4) Change the name to ProgressBarExHMI.vb
5) Right click the new file and select View Code
6) About 26 lines down, if neceaary, change the name from BarLevel to ProgressBarExHMI
6a) About 27 lines down you will see the code
Inherits MfgControl.AdvancedHMI.Controls.BarLevel7) Change this to
Inherits ProgressBarEx8 ) You will get 3 errors because the ProgressBarEx does not have a ValueScaleFactor property. This is resolved by deleting the overridden property of Text. Delete all of this code:
'******************************************************************************************
'* Use the base control's text property and make it visible as a property on the designer
'******************************************************************************************
<System.ComponentModel.Browsable(True)> _
<System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Visible)> _
Public Overrides Property Text() As String
Get
Return MyBase.Text
End Get
Set(ByVal value As String)
If m_Format <> "" And (Not DesignMode) Then
Try
MyBase.Text = Format(CSng(value) * m_ValueScaleFactor, m_Format)
Catch ex As Exception
MyBase.Text = "Check NumericFormat and variable type"
End Try
Else
'* Highlight in red if an exclamation mark is in text
If InStr(value, "!") > 0 Then
If MyBase.BackColor <> _Highlightcolor Then SavedBackColor = MyBase.BackColor
MyBase.BackColor = _Highlightcolor
Else
If SavedBackColor <> Nothing Then MyBase.BackColor = SavedBackColor
End If
If m_ValueScaleFactor = 1 Then
MyBase.Text = value
Else
MyBase.Text = value * m_ValueScaleFactor
End If
End If
End Set
End Property
9) Build the Solution
You should now have a ProgressBarExHMI in your Toolbox