I was just mucking around with a progress feature for some software, and thought I'd just put this wee demo up of a clocky type progress thing =0)
Just Copy and paste the form code and watch it run. (p.s it's in degrees, note minutes and seconds)
I was just mucking around with a progress feature for some software, and thought I'd just put this wee demo up of a clocky type progress thing =0)
Just Copy and paste the form code and watch it run. (p.s it's in degrees, note minutes and seconds)
Public Class Form1
Private BarWidth As Integer
Private CenterDiameter As Integer
Private ClockOffset As Point
Dim P As Point
Dim T As Timer
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
BarWidth = 40
CenterDiameter = 100
ClockOffset = New Point(50, 50)
'Set Background to White and DoubleBuffer
'to prevent flickering
Me.BackColor = Color.White
Me.DoubleBuffered = True
'Use a points multiple values as values
'for the two "Clock" angles
P = New Point(0, 0)
'Create a new timer object
T = New Timer
'Add handler for timer tick
AddHandler T.Tick, AddressOf TimerTick
'Set the timer interval and start it
'ticking
T.Interval = 1
T.Start()
End Sub
Private Sub TimerTick(sender As Object, e As EventArgs)
'Increment the inner sweep by 5 degrees
P.Y += 5
'Once inner has a complete circle
If P.Y > 359 Then
'reset inner ring sweep and increment outer
'ring sweep by 5 degrees
P.Y = 0
P.X += 5
'if outer ring is complete reset angle sweep 0
If P.X > 359 Then
P.X = 0
End If
End If
Me.Invalidate()
End Sub
Private Sub Form1_Paint(sender As Object, e As PaintEventArgs) Handles Me.Paint
'Use to offset each circle
Dim Points As Point = New Point
'Make sure our graphics are nice and smooth
e.Graphics.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
Points.X = ClockOffset.X
Points.Y = ClockOffset.Y
'Draw the outer dimmed ring
e.Graphics.FillEllipse(Brushes.DarkRed, New Rectangle(Points, New Size(CenterDiameter + (BarWidth * 2), CenterDiameter + (BarWidth * 2))))
'Draw the outer sweep ring
e.Graphics.FillPie(Brushes.Red, New Rectangle(New Point(Points), New Size(CenterDiameter + (BarWidth * 2), CenterDiameter + (BarWidth * 2))), -90, P.X)
Points.X = ClockOffset.X + (BarWidth \ 2)
Points.Y = ClockOffset.Y + (BarWidth \ 2)
'Draw the inner dimmed ring
e.Graphics.FillEllipse(Brushes.DarkBlue, New Rectangle(Points, New Size(CenterDiameter + BarWidth, CenterDiameter + BarWidth)))
'draw the inner sweep ring
e.Graphics.FillPie(Brushes.Blue, New Rectangle(Points, New Size(CenterDiameter + BarWidth, CenterDiameter + BarWidth)), -90, P.Y)
Points.X = ClockOffset.X + BarWidth
Points.Y = ClockOffset.Y + BarWidth
'Blot out the middle
e.Graphics.FillEllipse(Brushes.White, New Rectangle(Points, New Size(CenterDiameter, CenterDiameter)))
End Sub
End Class
Most eye-catchy and most appriciatable work to every newbee. Attching progress percentage would be gave it an another dimention.
This wee snippet is for inspiration not solution. Planting the seed of solution can often be more effective than providing a solution its self dont you think
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.