Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to achieve transparent icon on commandbutton
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 8
Miscellaneous
Thread ID:
00985396
Message ID:
00985865
Views:
48
>The solution is the same as the png files. VFP caches the first copy of an image that gets loaded. Then, every other time that image is needed, the cached copy is used. Image controls display images properly (including png, gif, jpg, etc.), but command buttons do not. Therefore you have to load the needed images into image controls BEFORE you use them on your buttons. One simple way is to take all of your images needed for a form and add them as image controls into a container (call it something like cntImages). Put the container on the form and make it invisible (it doesn't have to be shown to make this work). Take all the pictures off of your buttons (leave them blank). Add a custom method to your form (something like LoadImages) and call it from the end of the form's Init(). In that method, put code like this:
>
>
>this.cmdDelete.Picture = this.cntImages.imgDelete.Picture
>this.cmdNew.Picture = this.cntImages.imgNew.Picture
>this.pgfMain.Page1.cmdNew.Picture = this.cntImages.imgNew.Picture
>
>
>Notice that you can use the same image control for multiple buttons. You could also make this generic by adding a custom property to your buttons where you assign the name of the image control containing the needed picture.

Chad, Thank you for a very good explanation of what is happening and of how to do it. (I was wondering how you get an image to be the picture in a control).

Just did it. Very nice, too.

Alex
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform