Hi,
I try to use an ImageList with a ListView but that don't work.
I make a ListView in VirtualMode with LargeIcon view.
I put the ImageList in the LargeImageList property.
I add a bitmap to the ImageList
When i want to see the item "icon" with the imagelist imageindex
property that work, but with the imagekey property that don't work
At the form load :
ListView1.VirtualListSize = 1
In the RetrieveVirtualItem event (use ImageIndex):
Dim item As New ListViewItem("test", 0)
e.Item = item
That work
In the RetrieveVirtualItem event (unse ImageKey) :
Dim str As String = "1.JPG"
Dim item As New ListViewItem("test", str)
e.Item = item
That don't work ! However ImageList1.Images.ContainsKey(str) = true !
Could you help me ?
I have forgotten something ?
Thanks
(excuse me, i don't speak English very well) 4 14445
Hi Archimed
Your problem is with the way you set the image index
<1Dim str As String = "1.JPG"
<2Dim item As New ListViewItem("test", str)
<3e.Item = item
You can remove line <1and change line <2to this:
<2Dim item as new ListViewItem("test", 0)
The second parameter for the ListViewItem constructor as image index
position of the item's icon within the associated ImageList.
Hope this helps!
Archimed wrote:
Hi,
I try to use an ImageList with a ListView but that don't work.
I make a ListView in VirtualMode with LargeIcon view.
I put the ImageList in the LargeImageList property.
I add a bitmap to the ImageList
When i want to see the item "icon" with the imagelist imageindex
property that work, but with the imagekey property that don't work
At the form load :
ListView1.VirtualListSize = 1
In the RetrieveVirtualItem event (use ImageIndex):
Dim item As New ListViewItem("test", 0)
e.Item = item
That work
In the RetrieveVirtualItem event (unse ImageKey) :
Dim str As String = "1.JPG"
Dim item As New ListViewItem("test", str)
e.Item = item
That don't work ! However ImageList1.Images.ContainsKey(str) = true !
Could you help me ?
I have forgotten something ?
Thanks
(excuse me, i don't speak English very well)
Hi,
Thanks for your reply
But i need to use the imagelist with ImageKey
The ListViewItem contain however this constructor :
.... New(ByVal text As String, ByVal imageKey As String)
I don't know why that don't work (ImageList1.Images.ContainsKey(str) =
True ! ) gl*********@gmail.com wrote:
Hi Archimed
Your problem is with the way you set the image index
<1Dim str As String = "1.JPG"
<2Dim item As New ListViewItem("test", str)
<3e.Item = item
You can remove line <1and change line <2to this:
<2Dim item as new ListViewItem("test", 0)
The second parameter for the ListViewItem constructor as image index
position of the item's icon within the associated ImageList.
Hope this helps!
Archimed wrote:
Hi,
I try to use an ImageList with a ListView but that don't work.
I make a ListView in VirtualMode with LargeIcon view.
I put the ImageList in the LargeImageList property.
I add a bitmap to the ImageList
When i want to see the item "icon" with the imagelist imageindex
property that work, but with the imagekey property that don't work
At the form load :
ListView1.VirtualListSize = 1
In the RetrieveVirtualItem event (use ImageIndex):
Dim item As New ListViewItem("test", 0)
e.Item = item
That work
In the RetrieveVirtualItem event (unse ImageKey) :
Dim str As String = "1.JPG"
Dim item As New ListViewItem("test", str)
e.Item = item
That don't work ! However ImageList1.Images.ContainsKey(str) = true !
Could you help me ?
I have forgotten something ?
Thanks
(excuse me, i don't speak English very well)
Hi
Okay, I didn't see the constructor myself (it's good that they've added
it)...I am able to get it to work when not using the list view in
virtual mode but not while using VirtualMode. Very strange stuff!
Why not try the following as a workaround:
Dim str As String = "1.JPG"
Dim item As New ListViewItem("test",
ListView1.LargeImageList.Images.Key(str))
Of course this means you won't be able to change the View type as
easily (e.g. from LargeIcon to SmallIcon).
Sorry I couldn't help further.
Archimed wrote:
Hi,
Thanks for your reply
But i need to use the imagelist with ImageKey
The ListViewItem contain however this constructor :
... New(ByVal text As String, ByVal imageKey As String)
I don't know why that don't work (ImageList1.Images.ContainsKey(str) =
True ! ) gl*********@gmail.com wrote:
Hi Archimed
Your problem is with the way you set the image index
<1Dim str As String = "1.JPG"
<2Dim item As New ListViewItem("test", str)
<3e.Item = item
You can remove line <1and change line <2to this:
<2Dim item as new ListViewItem("test", 0)
The second parameter for the ListViewItem constructor as image index
position of the item's icon within the associated ImageList.
Hope this helps!
Archimed wrote:
Hi,
>
I try to use an ImageList with a ListView but that don't work.
>
I make a ListView in VirtualMode with LargeIcon view.
I put the ImageList in the LargeImageList property.
>
I add a bitmap to the ImageList
>
When i want to see the item "icon" with the imagelist imageindex
property that work, but with the imagekey property that don't work
>
At the form load :
ListView1.VirtualListSize = 1
>
In the RetrieveVirtualItem event (use ImageIndex):
Dim item As New ListViewItem("test", 0)
e.Item = item
>
That work
>
In the RetrieveVirtualItem event (unse ImageKey) :
Dim str As String = "1.JPG"
Dim item As New ListViewItem("test", str)
e.Item = item
>
That don't work ! However ImageList1.Images.ContainsKey(str) = true !
>
Could you help me ?
I have forgotten something ?
Thanks
>
(excuse me, i don't speak English very well)
Thanks a lot ! That's works :) gl*********@gmail.com wrote:
Hi
Okay, I didn't see the constructor myself (it's good that they've added
it)...I am able to get it to work when not using the list view in
virtual mode but not while using VirtualMode. Very strange stuff!
Why not try the following as a workaround:
Dim str As String = "1.JPG"
Dim item As New ListViewItem("test",
ListView1.LargeImageList.Images.Key(str))
Of course this means you won't be able to change the View type as
easily (e.g. from LargeIcon to SmallIcon).
Sorry I couldn't help further.
Archimed wrote:
Hi,
Thanks for your reply
But i need to use the imagelist with ImageKey
The ListViewItem contain however this constructor :
... New(ByVal text As String, ByVal imageKey As String)
I don't know why that don't work (ImageList1.Images.ContainsKey(str) =
True ! ) gl*********@gmail.com wrote:
Hi Archimed
>
Your problem is with the way you set the image index
<1Dim str As String = "1.JPG"
<2Dim item As New ListViewItem("test", str)
<3e.Item = item
>
You can remove line <1and change line <2to this:
<2Dim item as new ListViewItem("test", 0)
>
The second parameter for the ListViewItem constructor as image index
position of the item's icon within the associated ImageList.
>
Hope this helps!
>
Archimed wrote:
Hi,
I try to use an ImageList with a ListView but that don't work.
I make a ListView in VirtualMode with LargeIcon view.
I put the ImageList in the LargeImageList property.
I add a bitmap to the ImageList
When i want to see the item "icon" with the imagelist imageindex
property that work, but with the imagekey property that don't work
At the form load :
ListView1.VirtualListSize = 1
In the RetrieveVirtualItem event (use ImageIndex):
Dim item As New ListViewItem("test", 0)
e.Item = item
That work
In the RetrieveVirtualItem event (unse ImageKey) :
Dim str As String = "1.JPG"
Dim item As New ListViewItem("test", str)
e.Item = item
That don't work ! However ImageList1.Images.ContainsKey(str) = true !
Could you help me ?
I have forgotten something ?
Thanks
(excuse me, i don't speak English very well)
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Bob C. |
last post by:
Hi All,
I am using the ImageList/ListView Components to display around 100 images
in C#.NET.
The issue i have is, some times i may need to display the thumbnail of size
more then 256x256 in...
|
by: Andre Viens |
last post by:
Hello,
I am using the following variation of code from
<http://support.microsoft.com/default.aspx?scid=kb;EN-US;319340> to add icons
to an imagelist for use in a listview:
Private Structure...
|
by: GT |
last post by:
Could someone please explain how to add images to a ListView other than in
the first column?
|
by: sonu |
last post by:
Hi all,
Is there any upperbound on capacity of the listview control to hold the
images in it.
If yes then what could be the solution if i am using that imagelist to
display the icons in the...
|
by: jmDesktop |
last post by:
I have two listview controls. I have three items of text. I can drag
and drop the listview items between each other, back and forth. But
the images from the imagelist do not copy over from...
|
by: svx |
last post by:
Hello,
I am painting individual rows in a ListView control with different colors, depending on state. I am also using a SmallImageList in Detail view.
When I set the...
|
by: Lord Zoltar |
last post by:
Hi,
I've got a list view that displays a series of images. I'd like to be
able to draw a divider across the list view to divide the images into
groups. Ideally, I'd have a group name, with a line...
|
by: witpo |
last post by:
Hi,
I would like to display all listview items in one row with scroll bar below it – instead of multiple rows and scroll bar on the right. Someone told me that I can achieve it using...
|
by: elmbrook |
last post by:
Hi
I am trying to add an image to a listview box. I have the below code and according to me this should work. However, the image does not show at all. I can add an image when I manually add each...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |