Author Topic: ImageDisplayByValue  (Read 2741 times)

andrew_pj

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
ImageDisplayByValue
« 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

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: ImageDisplayByValue
« Reply #1 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.

andrew_pj

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
Re: ImageDisplayByValue
« Reply #2 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


bachphi

  • Hero Member
  • *****
  • Posts: 642
    • View Profile
Re: ImageDisplayByValue
« Reply #3 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???
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================

bachphi

  • Hero Member
  • *****
  • Posts: 642
    • View Profile
Re: ImageDisplayByValue
« Reply #4 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?
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: ImageDisplayByValue
« Reply #5 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

bachphi

  • Hero Member
  • *****
  • Posts: 642
    • View Profile
Re: ImageDisplayByValue
« Reply #6 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!
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================

bachphi

  • Hero Member
  • *****
  • Posts: 642
    • View Profile
Re: ImageDisplayByValue
« Reply #7 on: December 22, 2015, 08:41:31 PM »
Well, I found it, it's under SizeMode
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================

kanet45

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: ImageDisplayByValue
« Reply #8 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.

bachphi

  • Hero Member
  • *****
  • Posts: 642
    • View Profile
Re: ImageDisplayByValue
« Reply #9 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
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================