Author Topic: Just Another Gauge  (Read 10459 times)

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Just Another Gauge
« on: September 13, 2015, 09:31:48 PM »
This one is a work in progress, but I thought I would put it out to make it a community project. It was adapted from this:

https://github.com/bens-unit01/Circular-gauge-2

It currently does not adapt well to various size. The original was locked into a 400x400 size and I started making it able to change size.


Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Just Another Gauge
« Reply #1 on: September 13, 2015, 10:13:11 PM »
A short while ago I found that same control on the CodeProject website:

http://www.codeproject.com/Articles/20341/Aqua-Gauge

converted it from C# to VB Net and modified it to re-size properly.

Attached are the files that should just be added to PurchasedControls folder as ExistingItem.

If you are using AHMI v399d then don't use the AquaGaugeHMI.vb but instead use file attached to one of the posts below.
« Last Edit: April 08, 2016, 10:13:07 PM by Godra »

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Just Another Gauge
« Reply #2 on: September 13, 2015, 10:20:00 PM »
I noticed the reference to aqua gauge in the code and thought maybe just a coincidence. Maybe this was a precursor to the aqua gauge on CodePlex

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Just Another Gauge
« Reply #3 on: September 13, 2015, 10:27:11 PM »
There is one minor thing about this control that's still not completely resolved: digits are not evenly spaced from left and right edges.

If you type in Value property 55.55555 then you will notice that.

I guess that limiting decimal spaces to 2 could actually fix this (or just using integer value instead).

Edit:  The issue mentioned in this post has been corrected to a certain degree. See the posts below.
« Last Edit: April 08, 2016, 10:10:04 PM by Godra »

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Just Another Gauge
« Reply #4 on: September 13, 2015, 10:28:20 PM »
I checked the dates and the Aqua Gauge on CodeProject is dated 2007, but the one on GitHub is dated 2 years ago. But yet they have quite a similar appearance.

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Just Another Gauge
« Reply #5 on: September 13, 2015, 10:36:35 PM »
If you look at the code, properties are almost identical besides for the features that I added (and removed as well, which is public property EnableTransparentBackground).
« Last Edit: September 13, 2015, 10:41:03 PM by Godra »

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Just Another Gauge
« Reply #6 on: September 15, 2015, 01:52:06 AM »
This control has been improved for digit showing and the files have been replaced in one of the previous posts.

Here is a picture of what it could look like (with and without glossiness or in black suit).

Also attached is post-V399a AHMI file as of February 28, 2016 (you still have to add AquaGauge.vb file from previous post first).

Read the comments in the code for changes made to the original project.
« Last Edit: March 06, 2016, 09:02:53 AM by Godra »

Darrell

  • Full Member
  • ***
  • Posts: 198
  • Electrician / PLC Technician
    • View Profile
Re: Just Another Gauge
« Reply #7 on: March 05, 2016, 11:00:57 PM »
Tried to add this to v399d , Not sure how to go about fixing these errors


Error   1   Type 'AquaGauge' is not defined.   G:\! ! ! Advance HMI - March 4 2016\AdvancedHMIControls\PurchasedControls\AquaGaugeHMIv399.vb   29   14   AdvancedHMIControls
Error   2   'DesignMode' is not declared. It may be inaccessible due to its protection level.   G:\! ! ! Advance HMI - March 4 2016\AdvancedHMIControls\PurchasedControls\AquaGaugeHMIv399.vb   119   16   AdvancedHMIControls
Error   3   'IsHandleCreated' is not declared. It may be inaccessible due to its protection level.   G:\! ! ! Advance HMI - March 4 2016\AdvancedHMIControls\PurchasedControls\AquaGaugeHMIv399.vb   119   31   AdvancedHMIControls
Error   4   sub 'OnCreateControl' cannot be declared 'Overrides' because it does not override a sub in a base class.   G:\! ! ! Advance HMI - March 4 2016\AdvancedHMIControls\PurchasedControls\AquaGaugeHMIv399.vb   151   29   AdvancedHMIControls
Error   5   'DesignMode' is not a member of 'AdvancedHMIControls.AquaGaugeHMI'.   G:\! ! ! Advance HMI - March 4 2016\AdvancedHMIControls\PurchasedControls\AquaGaugeHMIv399.vb   154   12   AdvancedHMIControls
Error   6   'Parent' is not a member of 'AdvancedHMIControls.AquaGaugeHMI'.   G:\! ! ! Advance HMI - March 4 2016\AdvancedHMIControls\PurchasedControls\AquaGaugeHMIv399.vb   161   32   AdvancedHMIControls
Error   7   'Parent' is not a member of 'AdvancedHMIControls.AquaGaugeHMI'.   G:\! ! ! Advance HMI - March 4 2016\AdvancedHMIControls\PurchasedControls\AquaGaugeHMIv399.vb   163   20   AdvancedHMIControls
Error   8   'Parent' is not a member of 'AdvancedHMIControls.AquaGaugeHMI'.   G:\! ! ! Advance HMI - March 4 2016\AdvancedHMIControls\PurchasedControls\AquaGaugeHMIv399.vb   164   45   AdvancedHMIControls
Error   9   'Parent' is not a member of 'AdvancedHMIControls.AquaGaugeHMI'.   G:\! ! ! Advance HMI - March 4 2016\AdvancedHMIControls\PurchasedControls\AquaGaugeHMIv399.vb   174   78   AdvancedHMIControls
Error   10   'Text' is not a member of 'AdvancedHMIControls.AquaGaugeHMI'.   G:\! ! ! Advance HMI - March 4 2016\AdvancedHMIControls\PurchasedControls\AquaGaugeHMIv399.vb   199   32   AdvancedHMIControls
Error   11   'Text' is not a member of 'AdvancedHMIControls.AquaGaugeHMI'.   G:\! ! ! Advance HMI - March 4 2016\AdvancedHMIControls\PurchasedControls\AquaGaugeHMIv399.vb   204   13   AdvancedHMIControls
Error   12   'Text' is ambiguous, imported from the namespaces or types 'System, System.Drawing'.   G:\! ! ! Advance HMI - March 4 2016\AdvancedHMIControls\PurchasedControls\AquaGaugeHMIv399.vb   212   9   AdvancedHMIControls

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Just Another Gauge
« Reply #8 on: March 06, 2016, 08:33:27 AM »
It looks like you didn't add the AquaGauge.vb file from initial post first (you can add it now as ExistingItem to PurchasedControls folder and it should eliminate your errors).
« Last Edit: March 06, 2016, 09:01:05 AM by Godra »

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Just Another Gauge
« Reply #9 on: March 06, 2016, 03:44:15 PM »
Darrell,

Also make sure that you don't have both controls installed AquaGaugeHMI and AquaGaugeHMIv399 (remove AquaGaugeHMI since it is for older versios of AHMI).

Darrell

  • Full Member
  • ***
  • Posts: 198
  • Electrician / PLC Technician
    • View Profile
Re: Just Another Gauge
« Reply #10 on: March 06, 2016, 09:05:52 PM »
Visual basic is far from my expertise , Do I need both of these added to Purchased controls , does one Inherit the other,   AquaGauge.vb  and  AquaGaugeHMIv399.vb

If I only have AquaGaugeHMIv399.vb added I get all the above errors , If I add both I get this error

Error   1   'InitializeComponent' is not declared. It may be inaccessible due to its protection level.   
J:\Template V399d\AdvancedHMIControls\PurchasedControls\AquaGauge.vb   64   9   AdvancedHMIControls

red is where the error points

#Region "Constructor"

    Public Sub New()
        InitializeComponent()
        MyBase.DoubleBuffered = True
        Me.DoubleBuffered = True
        MyBase.ForeColor = Color.Orange
        x = 5
        y = 5
        wdth = Me.Width - 10
        hght = Me.Height - 10
        Me.m_noOfDivisions = 10
        Me.m_noOfSubDivisions = 4
        Me.SetStyle(ControlStyles.SupportsTransparentBackColor, True)
        Me.SetStyle(ControlStyles.ResizeRedraw, True)
        Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True)
        Me.SetStyle(ControlStyles.UserPaint, True)
        Me.SetStyle(ControlStyles.OptimizedDoubleBuffer, True)

Darrell
« Last Edit: March 06, 2016, 09:16:11 PM by Darrell »

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Just Another Gauge
« Reply #11 on: March 06, 2016, 09:31:27 PM »
You have to have both since AquaGaugeHMIv399.vb inherits from AquaGauge.vb.

From the first post you should download to the same location the following 3 files: AquaGauge.vb, AquaGauge.designer.vb and AquaGauge.resx and then attempt to add the AquaGauge.vb to your project.

Then you download the AquaGaugeHMIv399.vb and add it to your project as well.

It should work even if you reverse the steps.

For now, download the 3 mentioned files and add the AquaGauge.vb to your project again (it should ask you if you want to overwrite the existing file - just click "Yes").

Darrell

  • Full Member
  • ***
  • Posts: 198
  • Electrician / PLC Technician
    • View Profile
Re: Just Another Gauge
« Reply #12 on: March 06, 2016, 10:06:31 PM »
it worked only once I added all 4 to the Purchased Controls ,

Thanks
Darrell


DavidSr

  • Full Member
  • ***
  • Posts: 170
    • View Profile
Re: Just Another Gauge
« Reply #13 on: March 04, 2019, 11:34:16 PM »
I tried getting the Aqua Gauge added to 399y Beta 26 and got down to one error I could not resolve. Has anyone got this upgraded yet.
David

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Just Another Gauge
« Reply #14 on: March 07, 2019, 09:26:04 PM »
The only error that should show would be related to"CommComponent" which should be renamed to "ComComponent".

Maybe try using the attached files, with adding AquaGauge.vb file first then adding AquaGaugeHMI.vb afterwards (remove the current files prior to doing any of these steps).
« Last Edit: March 07, 2019, 09:27:51 PM by Godra »