Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Transparent GIF images
Message
From
14/07/2006 16:51:37
Joel Leach
Memorial Business Systems, Inc.
Tennessee, United States
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01114632
Message ID:
01136571
Views:
15
FYI, I came up with a generic solution to this problem. Put the code below in FixTransparency.prg, then call FixTransparency(This) from the Init() of your CommandButton (or any other applicable) class. Works like a charm!
* Fix Image Transparency
* VFP/GDI+ has a bug where image transparency is not respected on buttons
* The solution is to load the picture in an image control first
* This program clears the image from cache and reloads it in an image control
Lparameters loControl as CommandButton
Local lcPicture, loImage as Image

* Only applies to formats that support transparency
lcPicture = loControl.Picture
If Empty(lcPicture) or !InList(Upper(JustExt(lcPicture)),"JPG","PNG","GIF")
    Return
EndIf 

* Clear image from cache
loControl.Picture = ""
Clear Resources (lcPicture)

* Reload picture in Image control
loImage = CreateObject("Image")
loImage.Picture = lcPicture

* Reset Picture on control
loControl.Picture = lcPicture
>Hi!
>
>How do I get foxpro to use my transparent GIF image in my button , IE it has a white background but when I open it in my graphics package, it shows no background & tells me it is transparent?
>
>Any help extremley appreciated
>
>TAI
Joel Leach
Microsoft Certified Professional
Blog: http://www.joelleach.net
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform