Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I didn�t have time to make it beautiful but here is a class that allows you to have a round indicator

 

Public Class RoundIndicator
   Public x, y, h, w As Integer
   Public MinValue As Integer = 0
   Public MaxValue As Integer = 100
   Public Value As Integer = 45
   Public p As Pen = New Pen(Color.Red, 4)
   Const startangle As Integer = 0

   Public Sub New(ByVal vx, ByVal vy, ByVal vHeight, ByVal vWidth)
       x = vx
       y = vy
       h = vHeight
       w = vWidth
   End Sub

   Public Sub draw(ByVal g As Graphics)
       Dim Angle As Double = 360 * (Value / (MinValue - MaxValue))
       g.DrawArc(p, x, y, w, h, Convert.ToInt32(startangle), Convert.ToInt32(startangle + Angle))
   End Sub
End Class

 

to use it place this in a form

 

Dim x As RoundIndicator

   Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
       x = New RoundIndicator(20, 30, 100, 100)

   End Sub

   Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint

       x.draw(e.Graphics)
   End Sub

   Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
       x.Value = x.Value + 1
       Me.Invalidate()
   End Sub

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...