Imports System.Drawing Imports System.Drawing.Drawing2D Public Class Gauge Dim i, j As Integer Public WriteOnly Property angle() As Integer Set(ByVal value As Integer) i = value Me.Invalidate() End Set End Property Public WriteOnly Property angle2() As Integer Set(ByVal value As Integer) j = value Me.Invalidate() End Set End Property Private Sub Gauge_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint Dim _rect As New Rectangle(-81, -81, 1, 1) Dim _rect1 As New Rectangle(-81, -81, 1, 1) ' Needle scale factor .5 = 1/2 size , 2 = size x 2 etc e.Graphics.ScaleTransform(1, 1, MatrixOrder.Append) ' Save the state. Dim graphics_state As GraphicsState = e.Graphics.Save() ' Translate to center on the form. Adjust height/width to reposition. e.Graphics.TranslateTransform(Me.Width \ 2, Me.Height \ 2, MatrixOrder.Append) ' Rotate i degrees. e.Graphics.RotateTransform(i, MatrixOrder.Prepend) 'Draw the needle in the rectangle e.Graphics.DrawImageUnscaled(My.Resources.needle_1, _rect) ' Restore the saved state. e.Graphics.Restore(graphics_state) e.Graphics.ScaleTransform(1, 1, MatrixOrder.Append) ' Translate to center on the form. Adjust height/width to reposition. e.Graphics.TranslateTransform(Me.Width \ 2, Me.Height \ 2, MatrixOrder.Append) ' Rotate j degrees. e.Graphics.RotateTransform(j, MatrixOrder.Prepend) 'Draw the needle in the rectangle e.Graphics.DrawImageUnscaled(My.Resources.needle_2, _rect1) e.Graphics.Restore(graphics_state) End Sub End Class