Hi,
I tried to use PictureBox Control in a HMI script but without success, I used the below instruction:
PictureBox1.Picture = "C:\Mio_C\Dappo\Test\ON.png";
But it doesn't work.
Any suggestion?
Thanks in advance!
c
Use the Image property and the Bitmap object.
Example:
Bitmap img = new Bitmap("C:\\Temp\\Media\\MyNewImage.jpg");
PictureBox1.Image = img;
Thank you very much!
Hi again,
...one more step, why this statement doesn't work?:
Label1.Text = HMI.ReadVariable("Output_1").ToString();
Thanks in advance
The HMI.ReadVariable() function returns an object, then you must to cast the type, for example, if you want to read by script code the value of PLC variable_1 (boolean type) and variable_2 (integer type), you must to write the following code:
bool v1 = (bool)HMI.ReadVariable("variable_1");
Label1.Text = v1.ToString();
int v2 = (int)HMI.ReadVariable("variable_2");
Label2.Text = v2.ToString();
Thanks again!
It doesen't works.
I'm a little bit confused... why this works:
bool b = (bool)HMI.ReadDB(0,0);
if(b)
{
Bitmap img = new Bitmap("C:\\Mio_C\\Dappo\\Test\\SW\\SW_ON.png");
PictureBox1.Image = img;
}
else
{
Bitmap img = new Bitmap("C:\\Mio_C\\Dappo\\Test\\SW\\SW_OFF.png");
PictureBox1.Image = img;
}
and this one not?:
bool b = (bool)HMI.ReadVariable("Output_1");
if(b)
{
Bitmap img = new Bitmap("C:\\Mio_C\\Dappo\\Test\\SW\\SW_ON.png");
PictureBox1.Image = img;
}
else
{
Bitmap img = new Bitmap("C:\\Mio_C\\Dappo\\Test\\SW\\SW_OFF.png");
PictureBox1.Image = img;
}
Both are placed in a HMI Timer Tick event.
Thanks in advance.
The two codes you have posted are right and must to work correctly!
Perhaps the problem is in other place.
If you send me the plc program, I can study it in order to help you.
;)
OK thanks, I'll send u in the afternoon, but a lot of strange things happen, for example is not possible set the visible property of controls, some some controls like toggle button did't works etc.
I'm running EasyPlc under Windows 8, could be this the problem?
Let me try to install a Windows XP virtual machine and install again EasyPLC over it, am I going to face trouble with the license if the virtual machine is on the same laptop?
The visibility property of the controls is now solved in the new release (5.5.3)!
I have not see any problem in the Toggle Button (tested in W7 & W8), can you explain with more detail?.
If you install the software in the same PC but with other Operative System, the license key could not be valid surely, due the license file is linked to the physical machine and Operative System.
Thanks for your support!
Probably I didn't get how toggle button works.... Let me make more tests :)
I'm going to simulate a Medium Voltage distribution system that supply the auxiliary systems of a Railway, included the automatic change over logics in case of fault.
I'll will post it as soon as I 'll complete.
c