הערה
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות להיכנס או לשנות מדריכי כתובות.
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות לשנות מדריכי כתובות.
Question
Thursday, January 25, 2018 2:13 PM
Hello All,
I'm not sure how to explain this, but heregos:
My computer crashed, I reinstalled VS2012. I have some progress bars in my application that I want to display the green progress bar, but also want the special (left to right) movement effect in the progressbar. I had it sometime back but don't know how I got it and how to get it back.
Screenshot:
ADawn
All replies (12)
Thursday, January 25, 2018 2:17 PM
It is the Marquee style (ProgressBarStyle Enumeration)
Thursday, January 25, 2018 3:48 PM
I have Marquee style and I get the green progress bar advancing while the code is running, but I don't get the display that I circled in the image above that is running through the progress bar (if that makes since).
ADawn
Friday, January 26, 2018 6:17 AM
I have Marquee style and I get the green progress bar advancing while the code is running, but I don't get the display that I circled in the image above that is running through the progress bar (if that makes since).
ADawn
Hi tropicwhisper,
One style is blocks, one is Marquee, which do you want to use?
ProgressBar1.Style = ProgressBarStyle.Blocks
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
With Button1
.Text = "Start ProgressBar"
End With
Button1.Enabled = False
With ProgressBar1
.Style = ProgressBarStyle.Blocks
.Step = 1
.Minimum = 0
.Maximum = 100
.Value = 0
End With
'if you repress the button now, it won't restart now
Do
'ALL events in your form will ahve to wait until this loop is completed!
Threading.Thread.Sleep(100)
ProgressBar1.PerformStep() 'can't use this if ProgressBar1.Style = ProgressBarStyle.Marquee
Loop Until ProgressBar1.Value >= ProgressBar1.Maximum
Button1.Enabled = True
Me.Button1.Text = "finished, press to restart"
End Sub
ProgressBar1.Style = ProgressBarStyle.Marquee
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
With Button2
.Text = "Start ProgressBar"
End With
Button2.Enabled = False
ProgressBar1.Style = ProgressBarStyle.Marquee
ProgressBar1.MarqueeAnimationSpeed = 30
Dim bw As BackgroundWorker = New BackgroundWorker()
AddHandler bw.DoWork, AddressOf bw_DoWork
AddHandler bw.RunWorkerCompleted, AddressOf bw_RunWorkerCompleted
bw.RunWorkerAsync()
End Sub
Private Sub bw_RunWorkerCompleted(sender As Object, e As RunWorkerCompletedEventArgs)
ProgressBar1.MarqueeAnimationSpeed = 0
ProgressBar1.Style = ProgressBarStyle.Blocks
ProgressBar1.Value = ProgressBar1.Maximum
Button2.Enabled = True
Me.Button2.Text = "finished, press to restart"
MessageBox.Show("Done!")
End Sub
Private Sub bw_DoWork(sender As Object, e As DoWorkEventArgs)
Thread.Sleep(5000)
End Sub
Best Regards,
Cherry
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Thursday, February 1, 2018 12:36 AM
Maybe I'm not clear. Please look at the picture I posted and you will see within the circle I drew an animated (thing) that goes from left to right within the green progress bar area. No matter which Progressbar.Style I use I cannot I get this effect.
ADawm
ADawn
Thursday, February 1, 2018 10:10 AM
Maybe I'm not clear. Please look at the picture I posted and you will see within the circle I drew an animated (thing) that goes from left to right within the green progress bar area. No matter which Progressbar.Style I use I cannot I get this effect.
ADawm
ADawn
No I think you are not clear, what kind of application is this Windows forms, WPF, 3th party, ....?
Success Cor
Friday, February 2, 2018 1:41 PM
Cor,
It is a windows desktop application built with vs2012.
Thanks,
ADawn
ADawn
Friday, February 2, 2018 8:04 PM
Cor,
It is a windows desktop application built with vs2012.
Thanks,
ADawn
ADawn
You have not mentioned, did you re-install the same OS version? What version?
Did you by any chance un-check the (Use XP visual styles) option in your application's properties?
Perhaps others could add input here because, i only have Win7 but, i know windows 8 and 10 use a flat bland looking 'metro' type theme and i am not sure if they use this special effect for progressbar controls or not. Maybe they do, maybe they don't.
If you say it can`t be done then i`ll try it
Friday, February 2, 2018 10:02 PM | 1 vote
Here is Windows 10 with xp styles enabled, block, continuous, marquee from top to bottom. This is just with the value = 50.
So it appears the marquee style is different from win 7 to 10.
This is win10 without xp styles enabled.
PS This is Windows 7 below.
Saturday, February 3, 2018 9:59 PM
Here is one made from a label (bottom).
'windows 7 marquee progressbar using a label
Imports System.Drawing.Drawing2D
Public Class Form2
Private WithEvents timer1 As New Timer With {.Enabled = True, .Interval = 100}
Private SpotX As Integer
Private Sub Label1_Paint(sender As Object, e As PaintEventArgs) Handles Label1.Paint
With e.Graphics
.Clear(Color.White)
Dim rect As Rectangle = Label1.ClientRectangle
'highlight
Dim colors As Color() = {Color.FromArgb(30, Color.Lime)}
Dim r As Integer = CInt(2 * rect.Height)
Using pthHighlight As New Drawing2D.GraphicsPath()
pthHighlight.AddEllipse(SpotX, CInt(-r / 3), 2 * r, r)
Using pthHighlightBr As New Drawing2D.PathGradientBrush(pthHighlight)
pthHighlightBr.CenterColor = Color.Lime
pthHighlightBr.SurroundColors = colors
.FillPath(pthHighlightBr, pthHighlight)
End Using
End Using
'background shadows
Using pth As New Drawing2D.GraphicsPath(),
lgbr As New LinearGradientBrush(rect, Color.White, Color.FromArgb(150, SystemColors.ControlDark), 90)
Dim myFactors As Single() = {0.0F, 0.4F, 0.8F, 0.8F, 0.4F, 0.2F}
Dim myPositions As Single() = {0.0F, 0.1F, 0.4F, 0.6F, 0.9F, 1.0F}
Dim myBlend As New Blend
myBlend.Factors = myFactors
myBlend.Positions = myPositions
lgbr.Blend = myBlend
pth.AddRectangle(rect)
.FillPath(lgbr, pth)
End Using
.DrawRectangle(New Pen(SystemColors.ControlDark, 1), rect)
End With
End Sub
Private Sub timer1_Tick(sender As Object, e As EventArgs) Handles timer1.Tick
SpotX += 6
If SpotX > Label1.Width + (Label1.Width / 2) Then
SpotX = -CInt(Label1.Width + (Label1.Width / 2))
End If
Label1.Invalidate()
End Sub
End Class
Sunday, February 4, 2018 12:07 PM | 1 vote
Hi Tom,
I believe it is just the white flash that periodically runs through the green progressbar that OP is saying they don.t seem to have. I don.t think it is actually a Marque style progress that they want. I can see in your second to last post that your Windows 10 progressbar has that fancy 'white flash' that runs across it (Image below) so, apparently 8 and 10 both have that too. Although, I still think the Windows 7 progressbar looks much better. 8)
At this point I don't know if OP is doing something with the progressbar to make it not show the 'white flash' or if it could be a corrupt installation of VS or OS that might be at fault.
If you say it can`t be done then i`ll try it
Sunday, February 4, 2018 12:36 PM | 1 vote
Maybe I'm not clear. Please look at the picture I posted and you will see within the circle I drew an animated (thing) that goes from left to right within the green progress bar area. No matter which Progressbar.Style I use I cannot I get this effect.
The animation can be disabled with the TurnOffSPIAnimations value in registry
But it would be weird that it has been set automatically.
Sunday, February 4, 2018 10:35 PM
Thanks for the demonstration of each. I'm running vs2012 on Win-10 x64.
I've tried each of the above (but will try again) and I do have XP Stypes Enabled flagged.
ADawn
ADawn