1
Open Discussion / Re: Change multi colors by value
« on: January 22, 2021, 05:11:43 AM »
It looks like i need just make new post, and after that in little or no time find the solution. Just changed code a little bit and voila, works.
Code: [Select]
Private Sub DataSubscriber21_DataChanged(sender As Object, e As Drivers.Common.PlcComEventArgs) Handles DataSubscriber21.DataChanged
If e.PlcAddress = "D125" And e.Values(0) = "0" Then
BasicShape1.BackColor = Color.LightGray
ElseIf e.PlcAddress = "D125" And e.Values(0) = "1" Then
BasicShape1.BackColor = Color.FromArgb(255, 255, 220)
ElseIf e.PlcAddress = "D125" And e.Values(0) = "2" Then
BasicShape1.BackColor = Color.FromArgb(255, 255, 170)
ElseIf e.PlcAddress = "D125" And e.Values(0) = "3" Then
BasicShape1.BackColor = Color.FromArgb(255, 255, 120)
ElseIf e.PlcAddress = "D125" And e.Values(0) = "4" Then
BasicShape1.BackColor = Color.FromArgb(255, 255, 50)
ElseIf e.PlcAddress = "D126" And e.Values(0) = "0" Then
BasicShape2.BackColor = Color.LightGray
ElseIf e.PlcAddress = "D126" And e.Values(0) = "1" Then
BasicShape2.BackColor = Color.FromArgb(255, 255, 220)
ElseIf e.PlcAddress = "D126" And e.Values(0) = "2" Then
BasicShape2.BackColor = Color.FromArgb(255, 255, 170)
ElseIf e.PlcAddress = "D126" And e.Values(0) = "3" Then
BasicShape2.BackColor = Color.FromArgb(255, 255, 120)
ElseIf e.PlcAddress = "D126" And e.Values(0) = "4" Then
BasicShape2.BackColor = Color.FromArgb(255, 255, 50)
End If
End Sub