Here is a very crude code i have knocked up this morning, it will help you get going. Now, I hadn't got a clue what i was doing either when i started, so answered this question as more of an learning for me more than anything! So apologies to anyone who thinks its rubbish!
first create a new form with the following controls (you can get the names from the code);
a textbox (for a duration in seconds)
a textbox (for the number of segments, note: this cannot exceed the number of seconds)
a button (to start the timer)
a button (to stop the timer)
a progress bar, just so you can see whats happening in between segment draws
a label, to hold the number of ticks also so you can see what is happening.
I started with 60 seconds and 10 segments, (so draws a new segment every 6 seconds), 60 and 60 works fine as well.
It is very crude, but functional, but you will need to do more bounds checking etc as i haven't bothered (hence the reason for the segments not being greater than number of seconds!).
Imports System.Drawing
Imports System.Drawing.Drawing2D
Public Class Form1
Private WithEvents theTimer As Timer = New Timer
Private timerTickCount As Integer = 0
Private timerTargetTicks As Integer = 0
Private Sub ButtonStart_Click(sender As System.Object, e As System.EventArgs) Handles ButtonStart.Click
theTimer.Interval = 1000
timerTickCount = 0
timerTargetTicks = CInt(TextBoxDuration.Text)
ProgressTimer.Minimum = 0
ProgressTimer.Value = 0
ProgressTimer.Maximum = timerTargetTicks
ProgressTimer.Step = 1
DrawTimerSurface()
theTimer.Start()
End Sub
Private Sub ButtonStop_Click(sender As System.Object, e As System.EventArgs) Handles ButtonStop.Click
theTimer.Stop()
End Sub
Private Sub theTimer_Tick(sender As Object, e As System.EventArgs) Handles theTimer.Tick
timerTickCount += 1
updateProgress()
End Sub
Private Sub updateProgress()
LabelTicks.Text = timerTickCount.ToString
ProgressTimer.Increment(1)
drawSegment(timerTickCount \ (timerTargetTicks / CInt(TextBoxSegments.Text)))
If timerTickCount >= timerTargetTicks Then
theTimer.Stop()
MsgBox("Finished!")
End If
End Sub
Private Sub DrawTimerSurface()
Dim timer_brush_background As Brush = Brushes.White
Me.CreateGraphics.FillPie(timer_brush_background, 15, 125, 250, 250, 0, 360)
Dim pen As New Drawing.Pen(System.Drawing.Color.Green, 1)
Me.CreateGraphics.DrawEllipse(pen, 15, 125, 250, 250)
End Sub
Private Sub drawSegment(segmentNumber As Integer)
If segmentNumber = 0 Then Exit Sub
Dim pie_brush As Brush = Brushes.Green
Dim segmentCount As Integer = CInt(TextBoxSegments.Text)
Dim segmentAngle As Integer = 360 / segmentCount
Dim startAngle As Integer = ((segmentAngle * segmentNumber) - segmentAngle) - 90
Me.CreateGraphics.FillPie(pie_brush, 15, 125, 250, 250, startAngle, segmentAngle)
End Sub