Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Transparent GIF images on buttons
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Divers
Thread ID:
01533051
Message ID:
01533631
Vues:
102
Hey Rick,

Clearing the Image object is not enough to remove it from memory. If you need so, dont forget to use:

CLEAR RESOURCES (your image)

HTH


BTW, loving to see your newest blog posts. One from last week, about the big variables was really helpful. Thanks!




>After some more tweaking around with this I also managed to get this to work.
>
>I'm now doing something similar to what you're doing except I don't keep the images around. I simply create an image control and release it and that does work.
>
>I think the problem was one of timing - somehow the images where loading after they were assigned to the Picture property of the buttons etc.
>
>I have a blog post coming for this in the next few days to clarify since this doesn't appear to be mentioned anywhere else in detail.
>
>+++ Rick ---
>
>
>>I don't know why it's not working, and you already have a workaround, but I'll go ahead and explain what we do in more detail...
>>
>>We have a DBF that contains a list of PNGs we want to cache to fix the transparency problem. Early in the startup of our application object (before any menus or forms are loaded), we scan through that DBF and call the CacheImage() method below for each record. Doing it at startup seems to be key. Like you, we couldn't get it to work reliably if we tried to do it in the form. Also, if you use the same image in a menu, you have to cache the image before the menu is loaded. The collection is a member of the application object, so it stays in memory. Here's the code:
>>
>>* Cache image to prevent transparency problem on buttons and menus
>>Lparameters lcImage
>>Local loColImageCache as Collection, loImage as Image
>>
>>If Vartype(This.colImageCache) <> "O" or IsNull(This.colImageCache)
>>	This.colImageCache = CreateObject("Collection")
>>EndIf
>>loColImageCache = This.colImageCache && for IntelliSense
>>
>>* Add image to cache
>>If loColImageCache.GetKey(lcImage) = 0
>>	loImage = CreateObject("Image")
>>	loImage.Picture = lcImage
>>	loColImageCache.Add(loImage, lcImage)
>>EndIf 
>>
>>
>>>I haven't been able to get that to work in any way shape or form...
>>>
>>>What are you doing exactly to load up the Image controls? Just set the Picture property?
>>>
>>>For me this doesn't work I always see the non-clear background. This even happens if I stick the image control on the same page and make sure it renders before the button with the Picture. Even then I see the button show with background while the image control does not...
>>>
>>>Like Cesar I've resigned myself to converting images to BMP and filling in white space with an an off white color. It's more work but at least it works reliably.
>>>
>>>+++ Rick ---
>>>
>>>>>Hi Rick,
>>>>>
>>>>>There is something wrong in VFP caching the pictures.
>>>>>
>>>>>the trick is to load the image first in a picture object (e.g. on _Screen) without necessarily display them. This way the pictures transparancy information is cached correctly so that when the same picture is used for a command/option button etc, it is respecting its transparancy.
>>>>>
>>>>>I'd consider this am internal bug with PNG and GIF pictures.
>>>>>
>>>>>Walter,
>>>>>
>>>>
>>>>We load all of our transparent PNGs into a collection of image objects at application startup before any UI or menus are displayed. We keep the collection alive for the duration of the app. We don't have any problems, but you have to load the images early. If VFP gets to them first on a button or menu, loading them into an image may not help.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform