Author Topic: Compact Gauge Band Colors  (Read 1589 times)

DavidSr

  • Full Member
  • ***
  • Posts: 170
    • View Profile
Compact Gauge Band Colors
« on: September 25, 2019, 06:08:17 AM »
I was looking at the code for the Compact Gauge and I see the code for band colors is not in there so I am guessing it is in another file??? a dll?

Anyway I was going to try to add another band. If anyone has the time Can you direct me somewhere to find out how to do that? I would like to add a 4th band.
Thank you!
David

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Compact Gauge Band Colors
« Reply #1 on: September 25, 2019, 06:20:45 AM »
You will need to override the OnPaint method and add additional drawing commands using GDI+. For example, to make and extended version of the gage, create a new class as such:
Code: [Select]
Public Class CompactGageEx
    Inherits GaugeCompact

    Protected Overrides Sub OnPaint(e As PaintEventArgs)
        MyBase.OnPaint(e)

        e.Graphics.DrawArc(Pens.White, 1, 1, 10, 100, 0, 50)
        e.Graphics.DrawLine(Pens.Violet, 0, 0, Me.Width, Me.Height)
    End Sub
End Class