AdvancedHMI Software
General Category => Support Questions => Topic started by: oqapsking on May 08, 2017, 02:42:39 PM
-
i am trying to stretch the background image from image list when using with ImageDisplayByValue component
so i add this property to the ImageDisplayByValue class code
Public Property BackgroundImageLayou As ImageLayout
Get
Return BackgroundImageLayout
End Get
Set(ByVal value As ImageLayout)
BackgroundImageLayout = value
End Set
End Property
after i add the code
the property appears in ImageDisplayByValue1 properties and i choose stretch but nothing happens
any ideas ?
with thanks
-
What you have done is merely create a property that stores a value in a variable that Visual Studio implicitly created. You stored value then goes no where, therefore does nothing.
I think what you are trying to do is fill you ImageDisplayByValue with your images from the ImageList. To do this, simply set the ImageSize property of your ImageList to the same dimensions as the Size property of your ImageDisplayByValue.
In other words get the Size of your ImageDisplayByValue, then select the ImageList and copy that size into the ImageSize property.
-
Yes but i still need my image to be biger than 256;256
And that is why i need to make it strech
So it would fit good with my design
-
I don't think this is possible with this control. It looks like it will be necessary to create a custom control that does not use the ImageList, but instead uses a collection of images.
-
can you tell me how to make an image colliction ?
i tried to make this class
but it is not user friendly
i put the pictures i needed in the project resorces with a seqal name
then i use this code
the user class has picturebox and basiclabel
Public Class curt1
Dim listpic As String
Dim defealtpic As String
Private Sub BasicLabel1_ValueChanged(sender As Object, e As EventArgs) Handles BasicLabel1.ValueChanged
Dim object_name_as_string = listpic
Dim es As String = BasicLabel1.Value.ToString
defealtpic = Label1.Text + "1"
If BasicLabel1.Value > 0 Then
listpic = defealtpic + es
PictureBox2.Image = Global.MfgControl.AdvancedHMI.My.Resources.Resources.ResourceManager.GetObject(listpic)
Else
PictureBox2.Image = Global.MfgControl.AdvancedHMI.My.Resources.Resources.ResourceManager.GetObject(defealtpic)
End If
End Sub
Private Sub curt1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Public Property ComComponent As MfgControl.AdvancedHMI.Drivers.IComComponent
Get
Return BasicLabel1.ComComponent
End Get
Set(value As MfgControl.AdvancedHMI.Drivers.IComComponent)
BasicLabel1.ComComponent = value
End Set
End Property
Public Property firstchar As String
Get
Return Label1.Text
End Get
Set(value As String)
Label1.Text = value
End Set
End Property
Public Property firstimage As Bitmap
Get
Return PictureBox2.Image
End Get
Set(value As Bitmap)
PictureBox2.Image = value
End Set
End Property
Public Property PLCAddressValue As String
Get
Return BasicLabel1.PLCAddressValue
End Get
Set(value As String)
BasicLabel1.PLCAddressValue = value
End Set
End Property
End Class
-
This is a bit more complex than I initially thought because of the design time editor for the Image Collection. I'll see what I can come up with over the next few days.
-
OK AND THANKS FOR YOUR HELP : )
-
You could also try adding these 2 properties to the original ImageDisplayByValue control:
<System.ComponentModel.Browsable(False)> _
Public Shadows Property ImageIndex As Integer
Get
Return -1
End Get
Set(ByVal value As Integer)
If ImageList IsNot Nothing AndAlso ImageList.Images.Count > 0 Then
If value > -1 AndAlso value < ImageList.Images.Count Then
Me.BackgroundImage = ImageList.Images(value)
End If
End If
End Set
End Property
Public Property ImageLayout As ImageLayout
Get
Return MyBase.BackgroundImageLayout
End Get
Set(ByVal value As ImageLayout)
MyBase.BackgroundImageLayout = value
End Set
End Property
-
You could also try adding these 2 properties to the original ImageDisplayByValue control:
<System.ComponentModel.Browsable(False)> _
Public Shadows Property ImageIndex As Integer
Get
Return -1
End Get
Set(ByVal value As Integer)
If ImageList IsNot Nothing AndAlso ImageList.Images.Count > 0 Then
If value > -1 AndAlso value < ImageList.Images.Count Then
Me.BackgroundImage = ImageList.Images(value)
End If
End If
End Set
End Property
Public Property ImageLayout As ImageLayout
Get
Return MyBase.BackgroundImageLayout
End Get
Set(ByVal value As ImageLayout)
MyBase.BackgroundImageLayout = value
End Set
End Property
thanks godra but it gave the same result i can chose stretch but nothing happens
-
That property is designed to have all images stretch to fit the size of the control.
If you resize the control and/or change the layout to "Tile", does it look any different?
If your intention is to have the control resize itself and show images in their original size then you might need to wait for Archie's new solution.
-
That property is designed to have all images stretch to fit the size of the control.
If you resize the control and/or change the layout to "Tile", does it look any different?
If your intention is to have the control resize itself and show images in their original size then you might need to wait for Archie's new solution.
What i want is the image to strech as the sizrle of the control
But when i nothing happens when i chose strech or tile or zoom
It stays as the size of the imagelist in my case 256;256
-
To show how those 2 properties work, I have attached the picture of a motor being used in 2 differently sized controls.
The original motor picture is attached as well.
Is that what you are looking to have?
-
yes that is what i need but when i used ur code
i can choose strech but the image stays the same size no matter what is the imagedisplaybyvalues control size is
-
I have attached the control I am using.
Try it and see if it makes a difference (add it as existing item to the "Controls" folder and replace the existing control).
Once you use the control make sure that its AutoSize property is set to False (this since it might show as True).
I also set the ImageSize property to 256, 256.
-
I have attached the control I am using.
Try it and see if it makes a difference (add it as existing item to the "Controls" folder and replace the existing control).
Once you use the control make sure that its AutoSize property is set to False (this since it might show as True).
I also set the ImageSize property to 256, 256.
i did what you said but the same thing the ImageLayout have no effect look at the attachment
and thanks
-
Is your picture from Design Mode or Runtime?
-
both the same thing
-
Did you rebuild the solution after you added the control?
The ImageIndex property is currently set to be invisible and also not to show any image in Design Mode.
I am not sure how come that you can see the image.
-
how can i enable them so i can see the changes
-
Just comment out the first line of code above the ImageIndex property:
'<System.ComponentModel.Browsable(False)> _
This will allow you to test all the images by using the ImageIndex property.
Your image selection will not be memorized since the current modification is intended to prevent images from showing in the image frame.
The image layout will be memorized.