Author Topic: Build a gage with the AnimatedPictureBox  (Read 3075 times)

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Build a gage with the AnimatedPictureBox
« on: January 11, 2015, 08:01:18 PM »
The AnimatedPictureBox can be a bit overwhelming initially, but it has a lot of flexibility. This sample will show how to create a custom gage without the need for any code writing.

1) Add an AnimatedPictureBox to your form
2) Set the Size property to 200,200
3) Download the 2 attached files
4) On the BackgroundImage property, select and click the ellipses (button with 2 dots)
5) Click the Import button on the window to pops up
6) Browse to and select the RoundMeterBackground.png that was download in step 3
7) Make sure BackgroundImageLayout is set to Stretch
8) Go to the Image property, select and click the ellipses (button with 2 dots)
9) Click the Import button on the window to pops up
10) Browse to and select the RoundNeedle.png that was download in step 3
11) Set both ImageSizeXValue and ImageSizeYValue to 0.5, this will size the needle appropriately
12) Set the ImageTranslationYValue to 25
13) Expand down ImageRotationScale and set these values
           RotationCCWAngle -43
           RotationCWAngle   43
           RotationMaxValueCW 100
           YPosition 100

14) Set PLCAddressImageRotationValue to a valid PLC address


You should now have a meter that has a range from 0-100
« Last Edit: May 02, 2018, 09:46:43 AM by Archie »

Godra

  • Hero Member
  • *****
  • Posts: 1438
    • View Profile
Re: Build a gage with the AnimatedPictureBox
« Reply #1 on: January 12, 2015, 11:25:40 PM »
I am trying to make this work but it just wouldn't respond to a PLCAddressRotationValue set to a timer accumulator with a preset of 10.

After changing all instances of PLCAddressRotationValue to PLCAddressImageRotationValue inside AnimatingPictureBox.vb (#Region "PLC Related Properties") then I got the needle to respond to the timer accumulator and also to integer values of the analog input on MicroLogix 1000 Analog PLC.

The same applies to PLCAddressTranslateXValue and PLCAddressTranslateYValue.
« Last Edit: January 16, 2015, 05:47:36 PM by Godra »

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: Build a gage with the AnimatedPictureBox
« Reply #2 on: January 21, 2015, 09:07:21 PM »
Thanks for catching that. I corrected the class for the next version of 3.97d