Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Transparent Image
Message
De
14/07/2009 13:35:54
 
 
À
11/07/2009 14:34:23
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01406278
Message ID:
01412280
Vues:
47
>>>Hi All,
>>>
>>>I have placed an image on my applications desktop. How can I make parts of the image transparent so that the underlying desktop colour shows through?
>>>
>>>TIA
>>
>>When you say "transparent" do you mean fully transparent? If so, just make the areas of you image you want to be fully transparent to be white - RGB(255,255,255) and save the file as a BMP.
>>
>>Add it to an image control on the form and set the BackStyle = 0 (Transparent). Then all areas on your BMP that are RGB(255,255,255) will be transparent.
>>
>>If on the other hand you want to make parts of the image translucent, such that altthough the form and underlying objects show thru. the image itself also shows, like a smoky glass effect. For this you need to save your file as a PNG and set an Alpha Mask. This can be done with most paint programs. When you are done, just add the PNG to an image control. The unmasked parts will be transparent.
>>
>>Finally if you want to keep white on your image (white areas should not be transparent) then you have to use GDI+x to make another colour transparent instead of white. This you can read about here:
>>
>>http://weblogs.foxite.com/bernardbout/archive/2008/09/30/6947.aspx
>>
>>Bernard
>
>Hello Bernard and All,
>
>Thanks for the information and sorry for the delay in reply. I have tried the above but this does not seem to work for displaying an image on the desktop. I want parts of the image (the white part for example) to allow the desktop colour to show through. I can use any image format, bmp, png, etc. I am using _screen.addobject() to add the image to the desktop. Any other ideas?

By default the VFP image class makes any part of an image that is white RGB(255,255,255) Transparent if you set the image.Backstyle = 0. Note that this setting only works with .BMP

For PNG you must have created the image with Alpha transparency and VFP will show those parts as transparent automatically.

The blog post shows how you can make any colour. including white transparent, and also any image, BMP, GIF, JPG PNG TIF etc.which you normally cannot do with a vanilla VFP image control.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform