Author Topic: LineShape1  (Read 5226 times)

gerhardj

  • Newbie
  • *
  • Posts: 2
    • View Profile
LineShape1
« on: August 01, 2013, 06:10:30 PM »
Hi
I am new to Visual Studio. I have a LineShape1 that I want to move across a IP Camera input.
I got the line to move on click event, X1 and X2 value from PLC, Y1 and Y2 Set values. How can I make it update continuously

   Private Sub LineShape1_Click(sender As Object, e As EventArgs) Handles LineShape1.Click
        Me.LineShape1.BorderColor = System.Drawing.Color.Red
        Me.LineShape1.BorderWidth = 2
        Me.LineShape1.Name = "LineShape1"
        Me.LineShape1.X1 = 500 - EthernetIPforCLXComm1.ReadSynchronous("Axis1.RMCActPosition", 1)(0)
        Me.LineShape1.X2 = 500 - EthernetIPforCLXComm1.ReadSynchronous("Axis1.RMCActPosition", 1)(0)
        Me.LineShape1.Y1 = 100
        Me.LineShape1.Y2 = 500
    End Sub

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: LineShape1
« Reply #1 on: August 01, 2013, 09:49:33 PM »
There are a couple ways you could do this. The simplest would be to add a timer to your form, set the Enabled to true, double click then timer, then put your code in the Tick Event handler.

A more complicated, but more efficient method would be to subscribe to the PLC Address. You can see an example of this in post #26 in this thread:

http://www.plctalk.net/qanda/showthread.php?t=51758&page=2

gerhardj

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: LineShape1
« Reply #2 on: August 01, 2013, 10:38:10 PM »
Thanks Archie
The timer worked. I will play with the other one.