AdvancedHMI Software

General Category => Support Questions => Topic started by: andrew_pj on November 27, 2014, 09:10:48 PM

Title: ImageDisplayByValue
Post by: andrew_pj on November 27, 2014, 09:10:48 PM
Dear all,

Currently I use the latest version AdvancedHMIBetaV384, and the problem that I got in previous version still exists.
Basically I use ImageDisplayByValue and change the property 'Image' with my .png file.
I have copied my .png file to Resource folder, and save the project.
When it is running, the image is shown, which is correct.

I tried to close the whole program (visual basic), before that I saved already.
Then re-open the program, and my .png image is gone.
However, the ImageDisplayByValue is still there, and when I try to run, it is still showing.
So, in runtime there is no problem.
But the problem is in editor, I cannot see it, even in Properties 'Image', my .png file is also gone.
I tried using AdvancedHMILogo PNG but the result is still same.

Please advise the solution regarding this problem.
Thank you.


Best regards,
Andrew
Title: Re: ImageDisplayByValue
Post by: Archie on November 27, 2014, 09:23:46 PM
The ImageDisplayByValue works in conjunction with the ImageList. After adding the ImageDisplayByValue, you then need to selectthe ImageList and add images to it. The property ImageIndex in the ImageDisplayByValue then determines which of the images to show.

This control is designed to be used with many images. If you are using 3 or less images, then the GraphicInidcator would be a better choice.
Title: Re: ImageDisplayByValue
Post by: andrew_pj on November 27, 2014, 09:34:50 PM
Dear Archie,

Thanks for the solution.
With ImageIndex now it works fine, although I close the whole program and re-open, the image is still shown.
Thank you.


Best regards,
Andrew

Title: Re: ImageDisplayByValue
Post by: bachphi on December 18, 2015, 10:12:31 AM
Archie,   I added some JPG files to Image List collection, but the image display is too small, too compress, my box is like 900x700,  It seemed like It cant display anthing bigger than 256x256???
Title: Re: ImageDisplayByValue
Post by: bachphi on December 21, 2015, 09:06:28 PM
Archie, since ImageList's size is limited to 256x256, I am thinking of creating a much smaller size with ImageDisplayByValue, and a much bigger picturebox , then be able pass the index value to the Picturebox.

What do you think?
Title: Re: ImageDisplayByValue
Post by: Archie on December 21, 2015, 10:23:56 PM
Archie, since ImageList's size is limited to 256x256, I am thinking of creating a much smaller size with ImageDisplayByValue, and a much bigger picturebox , then be able pass the index value to the Picturebox.

What do you think?
One way to go about this is the following:

- Add a PictureBox
- Add a DataSubscriber and set PLCAddressValue
- Right click the AdvancedHMI project in Solution Explorer and select properties
- Select the Resources tab
- Add -> Existing File
- Select the pictures
- Back on the form design view, double click the DataSubscripber to get back to the DataChanged event handler
- Add this code:
Code: [Select]
    Private Sub DataSubscriber1_DataChanged(sender As Object, e As Drivers.Common.PlcComEventArgs) Handles DataSubscriber1.DataChanged
        Select Case e.Values(0)
            Case "1"
                PictureBox1.Image = My.Resources.AdvancedHMILogoBR
            Case "2"
                PictureBox1.Image = My.Resources.PictureFor2
            Case Else
                PictureBox1.Image = My.Resources.ImageWithNoValue
        End Select
    End Sub
Title: Re: ImageDisplayByValue
Post by: bachphi on December 22, 2015, 12:48:31 PM
Great solution as always!
The only thing I changed is to use BackGroundImage so that I can control the layout feature. not sure why Image dont have that feature.
Thanks, Archie!
Title: Re: ImageDisplayByValue
Post by: bachphi on December 22, 2015, 08:41:31 PM
Well, I found it, it's under SizeMode
Title: Re: ImageDisplayByValue
Post by: kanet45 on December 30, 2023, 08:46:36 AM
1. ImageDisplayByValue property set Autosize to False.
2. You can change size of image in the property of ImageList.
Title: Re: ImageDisplayByValue
Post by: bachphi on January 02, 2024, 09:30:24 AM
1. ImageDisplayByValue property set Autosize to False.
2. You can change size of image in the property of ImageList.

This is incorrect! Image size is limited to 255x255