Tim Carmichael
Top achievements
Rank 1
Tim Carmichael
asked on 25 Nov 2010, 12:59 PM
i'd like to display two values with the Telerik WinForm Progress bar; one value being the progress of a single action, and the second being the progress of all actions. For example, we're sending 5 emails, and performing an operation on each...one value is the progress of the operation of the individual email and the second is the overall progress.
Is this possible? Is there sample code available? I've looked at the documentation and demo app, but need more info.
Thanks in advance,
Gene
Is this possible? Is there sample code available? I've looked at the documentation and demo app, but need more info.
Thanks in advance,
Gene
15 Answers, 1 is accepted
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 25 Nov 2010, 01:36 PM
hello Tim,
I've prepared a small sample for you (just a RadProgressbar on a form) which sets the value1 for each of 4 tasks, and value 2 to be the overall progress.
Hope this helps but let me know if you have any questions.
Richard
I've prepared a small sample for you (just a RadProgressbar on a form) which sets the value1 for each of 4 tasks, and value 2 to be the overall progress.
Hope this helps but let me know if you have any questions.
Richard
Imports System Imports System.ComponentModel Imports Telerik.WinControls Imports Telerik.WinControls.UI Public Class Form1 Private WithEvents m_BackgroundWorker1 As New BackgroundWorker() Private WithEvents m_BackgroundWorker2 As New BackgroundWorker() Private WithEvents m_BackgroundWorker3 As New BackgroundWorker() Private WithEvents m_BackgroundWorker4 As New BackgroundWorker() Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load m_BackgroundWorker1.WorkerReportsProgress = True m_BackgroundWorker2.WorkerReportsProgress = True m_BackgroundWorker3.WorkerReportsProgress = True m_BackgroundWorker4.WorkerReportsProgress = True m_BackgroundWorker1.RunWorkerAsync() End Sub ' background 1 Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles m_BackgroundWorker1.DoWork For counter = 1 To 250 If counter Mod 10 = 0 Then Me.m_BackgroundWorker1.ReportProgress(Me.RadProgressBar1.Value1 + 1) System.Threading.Thread.Sleep(100) End If Next counter End Sub Private Sub BackgroundWorker1_ProgressChanged(ByVal sender As System.Object, ByVal e As System.ComponentModel.ProgressChangedEventArgs) Handles m_BackgroundWorker1.ProgressChanged Me.RadProgressBar1.Value2 = 25 Me.RadProgressBar1.Value1 = Me.RadProgressBar1.Value1 + 1 End Sub Private Sub BackgroundWorker1_RunWorkerCompleted(ByVal sender As System.Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles m_BackgroundWorker1.RunWorkerCompleted Me.m_BackgroundWorker2.RunWorkerAsync() End Sub ' background 2 Private Sub BackgroundWorker2_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles m_BackgroundWorker2.DoWork For counter = 1 To 250 If counter Mod 10 = 0 Then Me.m_BackgroundWorker2.ReportProgress(0) System.Threading.Thread.Sleep(100) End If Next counter End Sub Private Sub BackgroundWorker2_ProgressChanged(ByVal sender As System.Object, ByVal e As System.ComponentModel.ProgressChangedEventArgs) Handles m_BackgroundWorker2.ProgressChanged Me.RadProgressBar1.Value2 = 50 Me.RadProgressBar1.Value1 = Me.RadProgressBar1.Value1 + 1 End Sub Private Sub BackgroundWorker2_RunWorkerCompleted(ByVal sender As System.Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles m_BackgroundWorker2.RunWorkerCompleted Me.m_BackgroundWorker3.RunWorkerAsync() End Sub ' background 3 Private Sub BackgroundWorker3_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles m_BackgroundWorker3.DoWork For counter = 1 To 250 If counter Mod 10 = 0 Then Me.m_BackgroundWorker3.ReportProgress(0) System.Threading.Thread.Sleep(100) End If Next counter End Sub Private Sub BackgroundWorker3_ProgressChanged(ByVal sender As System.Object, ByVal e As System.ComponentModel.ProgressChangedEventArgs) Handles m_BackgroundWorker3.ProgressChanged Me.RadProgressBar1.Value2 = 75 Me.RadProgressBar1.Value1 = Me.RadProgressBar1.Value1 + 1 End Sub Private Sub BackgroundWorker3_RunWorkerCompleted(ByVal sender As System.Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles m_BackgroundWorker3.RunWorkerCompleted Me.m_BackgroundWorker4.RunWorkerAsync() Me.RadProgressBar1.Value2 = 100 End Sub ' background 4 Private Sub BackgroundWorker4_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles m_BackgroundWorker4.DoWork For counter = 1 To 250 If counter Mod 10 = 0 Then Me.m_BackgroundWorker4.ReportProgress(0) System.Threading.Thread.Sleep(100) End If Next counter End Sub Private Sub BackgroundWorker4_ProgressChanged(ByVal sender As System.Object, ByVal e As System.ComponentModel.ProgressChangedEventArgs) Handles m_BackgroundWorker4.ProgressChanged Me.RadProgressBar1.Value1 = Me.RadProgressBar1.Value1 + 1 End Sub Private Sub BackgroundWorker4_RunWorkerCompleted(ByVal sender As System.Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles m_BackgroundWorker4.RunWorkerCompleted RadMessageBox.Show("All Complete", "Done", MessageBoxButtons.OK, RadMessageIcon.Info) End SubEnd Class0
Tim Carmichael
Top achievements
Rank 1
answered on 25 Nov 2010, 02:28 PM
Thank you Richard,
I created a new VB project and pasted your code in after adding the Telerik Progress bar, but when I run it I only see a single progess value (no lighter or darker shade). Is there a property that I need to set on the control?
Regards
I created a new VB project and pasted your code in after adding the Telerik Progress bar, but when I run it I only see a single progess value (no lighter or darker shade). Is there a property that I need to set on the control?
Regards
0
Richard Slade
Top achievements
Rank 2
answered on 25 Nov 2010, 02:41 PM
Hello,
No, there's nothing else to set, but to be fair, the Value2 is not that easy to see on the default theme. Set the background colour of the FillPrimitive to white to see it a little better. Please can you add this to the end of the load event and you'll see it.
Let me know if you need more help
Richard
No, there's nothing else to set, but to be fair, the Value2 is not that easy to see on the default theme. Set the background colour of the FillPrimitive to white to see it a little better. Please can you add this to the end of the load event and you'll see it.
Dim prim As Telerik.WinControls.Primitives.FillPrimitive = CType(Me.RadProgressBar1.ProgressBarElement.Children(0), Telerik.WinControls.Primitives.FillPrimitive) prim.BackColor = Color.White prim.GradientStyle = GradientStyles.SolidLet me know if you need more help
Richard
0
Tim Carmichael
Top achievements
Rank 1
answered on 25 Nov 2010, 02:57 PM
Richard,
Ah...Thank you very much- that was the issue. A '"ittle hard to see?"- thats an understatement! With the white background its a 'little hard to see'! I expect I have to create a custom theme to change the secondary color? I'm new to Telerik controls, so any documentation you could point me to would be appreciated- I lost a day just because I couldnt see value2 changing.
Regards
Ah...Thank you very much- that was the issue. A '"ittle hard to see?"- thats an understatement! With the white background its a 'little hard to see'! I expect I have to create a custom theme to change the secondary color? I'm new to Telerik controls, so any documentation you could point me to would be appreciated- I lost a day just because I couldnt see value2 changing.
Regards
0
Richard Slade
Top achievements
Rank 2
answered on 25 Nov 2010, 03:03 PM
Hi Tim,
I'd suggest making your own theme for the radProgressBar if you intend to use a lot of them. Have a look at this link about the Visual Style Builder.
If you just want to change one or two colours on one RadProgressBar, then let me know what colours you want to change and I'll point you in the right direction.
Regards,
Richard
I'd suggest making your own theme for the radProgressBar if you intend to use a lot of them. Have a look at this link about the Visual Style Builder.
If you just want to change one or two colours on one RadProgressBar, then let me know what colours you want to change and I'll point you in the right direction.
Regards,
Richard
0
Tim Carmichael
Top achievements
Rank 1
answered on 25 Nov 2010, 03:14 PM
Thanks so much Richard,
I haven't used the Visual Style Builder yet so your help is greatly appreciated. For now I'd like to just use two shades of Blue, a medium and a darker blue for the progress indicator values. Visual Style Builder looks pretty good, but for now I need to show it working. The default Green and very light gray obviously doesnt work for me.
I haven't used the Visual Style Builder yet so your help is greatly appreciated. For now I'd like to just use two shades of Blue, a medium and a darker blue for the progress indicator values. Visual Style Builder looks pretty good, but for now I need to show it working. The default Green and very light gray obviously doesnt work for me.
0
Richard Slade
Top achievements
Rank 2
answered on 25 Nov 2010, 03:19 PM
You're welcome Tim,
may I ask that you mark as answer all suggestions that you find have helped.
There may be a quick way, but I'm not sure how well this would suit your requirements.
1: Drop a BreezeExtended theme onto the form from the toolbox
2: Change the ThemeName of the radProgressbar to BreezeExtended
3: Maintain the white back colour.
have a look and let me know if that's ok.
Richard
may I ask that you mark as answer all suggestions that you find have helped.
There may be a quick way, but I'm not sure how well this would suit your requirements.
1: Drop a BreezeExtended theme onto the form from the toolbox
2: Change the ThemeName of the radProgressbar to BreezeExtended
3: Maintain the white back colour.
have a look and let me know if that's ok.
Richard
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 25 Nov 2010, 03:24 PM
Here you go Tim,
This should be better.
Richard
This should be better.
Me.RadProgressBar1.ThemeName = "BreezeExtended"Dim prim As Telerik.WinControls.Primitives.FillPrimitive = CType(Me.RadProgressBar1.ProgressBarElement.Children(0), Telerik.WinControls.Primitives.FillPrimitive) prim.BackColor = Color.White prim.GradientStyle = GradientStyles.Solid Dim progressBarPrim As Telerik.WinControls.Primitives.ProgressBarPrimitive = CType(Me.RadProgressBar1.ProgressBarElement.Children(1), Telerik.WinControls.Primitives.ProgressBarPrimitive) progressBarPrim.BackColor = Color.Blue progressBarPrim.BackColor2 = Color.Blue progressBarPrim.GradientStyle = GradientStyles.SolidRichard
0
Tim Carmichael
Top achievements
Rank 1
answered on 25 Nov 2010, 03:25 PM
Richard,
The darker blue is great, but the light blue is still much too light.
Regards
The darker blue is great, but the light blue is still much too light.
Regards
0
Richard Slade
Top achievements
Rank 2
answered on 25 Nov 2010, 03:28 PM
0
Tim Carmichael
Top achievements
Rank 1
answered on 25 Nov 2010, 03:30 PM
Richard,
Thats much better. A shame to have lost the highlighting on the value1 progress, but I assume I can restore that by working with the visual Style builder. Thanks again,
Regards
Thats much better. A shame to have lost the highlighting on the value1 progress, but I assume I can restore that by working with the visual Style builder. Thanks again,
Regards
0
Richard Slade
Top achievements
Rank 2
answered on 25 Nov 2010, 03:33 PM
You're welcome Tim. Glad to have been able to help.
Please remember to mark as answer.
Richard
Please remember to mark as answer.
Richard
0
Richard Slade
Top achievements
Rank 2
answered on 25 Nov 2010, 03:35 PM
Tim
to get the linear look back set
Richard
to get the linear look back set
Dim progressBarPrim As Telerik.WinControls.Primitives.ProgressBarPrimitive = CType(Me.RadProgressBar1.ProgressBarElement.Children(1), Telerik.WinControls.Primitives.ProgressBarPrimitive) progressBarPrim.BackColor = Color.Blue progressBarPrim.BackColor2 = Color.Blue progressBarPrim.GradientStyle = GradientStyles.Linear0
Tim Carmichael
Top achievements
Rank 1
answered on 25 Nov 2010, 03:41 PM
Thats great. The odd thing is the 'highlight' lighter shade on the value1 bar is now on the bottom of the bar. But you've shown me plenty- I'm sure I can sort the rest. Much appreciated.
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 25 Nov 2010, 04:04 PM