[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

BeeJ

7/21/2012 12:10:00 AM

ListView with ImageList SmallIcons.

I have a working version that does not blink much (the icons do
slightly) since I work the listview rows then go through each row and
get the icons in imagelist reloaded fresh each time for the specific
filename creating duplicate images by Index (not key) so the imagelist
index matches the listview row index. This is OK but would like to
only update the imagelist (by Key) when needed and only update the
ListView when needed. The listview may add or subtract a row or more
during updates.

Is there an easy way to update the ImageList for ListView without
disconnecting it and causeing the ListView icons to disappear?

How do I check the image list to see if an icon, by Key, is already
there other than using an error handling technique? There seems to be
no Exists method.

I am updating the ListView with filenames and putting up the associated
icon for the file. Since there may be duplicaes of the filename I do
not want to process getting the icon if I already have it.

I also do not want to reload the icons in the listview every pass and
do not want it to blink.

--
Present and unaccounted for.


3 Answers

Larry Serflaten

7/21/2012 6:48:00 PM

0

BeeJ wrote:

> How else can I do ImageExists?


Keep it simple....

LFS


Option Explicit
Private Keys As String
Const Delimiter = "*"

Private Sub Form_Initialize()
Keys = Delimiter
End Sub

Private Function KeyExists(Key As String) As Boolean
KeyExists = CBool(InStr(Keys, Delimiter & UCase$(Key) & Delimiter))
End Function

Private Sub ImgAdd(Key As String, Img As StdPicture)
If Not KeyExists(Key) Then
' imlIcons.ListImages.Add(, UCase$(sKey), Img.Image)
Keys = Keys & UCase$(Key) & Delimiter
End If
End Sub

MikeD

7/21/2012 11:54:00 PM

0



"Larry Serflaten" <serflaten@gmail.com> wrote in message
news:3d7f469c-7d64-4e82-bcbb-e663c2f0bfcb@googlegroups.com...
> BeeJ wrote:
>
>> How else can I do ImageExists?
>
>
> Keep it simple....
>
> LFS
>
>
> Option Explicit
> Private Keys As String
> Const Delimiter = "*"
>
> Private Sub Form_Initialize()
> Keys = Delimiter
> End Sub
>
> Private Function KeyExists(Key As String) As Boolean
> KeyExists = CBool(InStr(Keys, Delimiter & UCase$(Key) & Delimiter))
> End Function
>
> Private Sub ImgAdd(Key As String, Img As StdPicture)
> If Not KeyExists(Key) Then
> ' imlIcons.ListImages.Add(, UCase$(sKey), Img.Image)
> Keys = Keys & UCase$(Key) & Delimiter
> End If
> End Sub
>

Just curious, but how is that simpler than just trapping for a specific
error number?

Mike


Larry Serflaten

7/22/2012 12:54:00 AM

0

MikeD wrote:
>
> Just curious, but how is that simpler than just trapping for a specific
> error number?


Post your code so we can compare!

Just a suggestion...
LFS