Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dynamically adding icons in Imagelist Control
Message
 
 
À
06/03/2007 20:57:22
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Divers
Thread ID:
01201325
Message ID:
01201339
Vues:
18
>Hi Guys, Im try to use the listview Control in VFP9. I've added the control together with an Imagelist control to hold the icons.
>
>The problem is, when I run the form, the item in the listview does not contain any image. Below is the code that I placed in the Init Event of my form.
>
>Note: I have not placed any Images in the designer of the Imaglist control. I want to assign the images dynamically.
>
>
>ThisForm.oleImageList1.ListImages.Add(,JustStem('1st Module'),LoadPicture('FLGAUSTA.ICO'))
>ThisForm.oleListView.Icons = ThisForm.oleImageList1
>	
>With ThisForm.oleListView.ListItems
>loImageListItem = ThisForm.oleImageList1.Object.ListImages('1st Module')
>liImageIndex = 0
>thisform.olelistView.ListItems.Add(,'AFJK','1st Module',liImageIndex,liImageIndex)
>ENDWITH 	
>	
>thisform.olelistView.Refresh()
>
>
>Am I missing something?
>Thanks in advance....

Try to use a simple key:
Re: 'Invalid Key' error in listview Thread #831903 Message #832927

Here is also a sample from IconBuddy class File #15832(http://www.personalplanung.com/download/IconBuddy_1_4b_4.zip)
*-- Clean up first
	Thisform.listView.ListItems.Clear
	Thisform.ListView.Object.Icons 		= .NULL.
	Thisform.ListView.Object.SmallIcons = .NULL.
	Thisform.ImageListLarge.ListImages.Clear
	Thisform.ImageListSmall.ListImages.Clear

	if lnIcons > 0	
		for lnI = 1 to alen(loIconBuddy.aIcons, 1)
			lcIconKey	= justExt(lcFile) + sys(2015)

			Thisform.ImageListLarge.ListImages.Add( ,lcIconKey, loIconBuddy.aIcons[lnI, 1] )
			Thisform.ImageListSmall.ListImages.Add( ,lcIconKey, loIconBuddy.aIcons[lnI, 2] )

			if lnI = 1
				ThisForm.ListView.Object.Icons 		= ThisForm.ImageListLarge.Object
				Thisform.ListView.Object.SmallIcons = ThisForm.ImageListSmall.Object
			endif
		
			Thisform.ListView.ListItems.Add(, lcIconKey, "This is Icon No."+padl(lnI,3,"0") , ;
				ThisForm.ImageListLarge.ListImages.Count,;
				ThisForm.ImageListSmall.ListImages.Count)

		endfor &&* lnI = 1 to alen(loIconBuddy.aIcons, 1)
	endif
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform