Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Extract Associated Icon to a Treeview
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00668799
Message ID:
00669162
Vues:
18
>Has anybody had any success in setting the icon in a treeview control to the icon associated with a file?
>
>I wish to have the subnodes of a treeview control display the icon based on the file extension of a file.
>
>I would assume that I would use the ExtractAssociatedIcon API call to accomplish this, but every time I think I am on the right track I get the C00000005 error in VFP7 SP1.
>
>Thanks in Advance,

Troy,
AFAIK, the only way to add images to a treeviw is to have an associated ImageList control. You can then use the LoadPicture function to access the file-based image and load it into the Imagelist. You can then set the Icon property of each treeview node. Rough example:
Imagelist Control
With THIS.ListImages
   .Add(,'Extension1', LoadPicture('MyPicture1.Bmp'))
   .Add(,'Extension2', LoadPicture('MyPicture2.Bmp'))
Endwith

Treeview Control
THIS.Imagelist = <object reference to Imagelist control>

THIS.Nodes.Add(,,'Root','Root','Extension1')
The Extension1 in the Nodes.Add call specifies the key of the image to use in the Imagelist control. You can also change the icon on-the-fly by getting an object reference to the Node in question and changing its Image property.

HTH.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform