Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Transparent Gif
Message
From
18/05/2005 06:20:05
Dorin Vasilescu
ALL Trans Romania
Arad, Romania
 
 
To
17/05/2005 13:15:10
Emerson Reed
Folhamatic Tecnologia Em Sistemas
Americana - São Paulo, Brazil
General information
Forum:
Visual FoxPro
Category:
Pictures and Image processing
Title:
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01014997
Message ID:
01015251
Views:
23
Hi
From VFP9 help
For high resolution Transparent GIF images, the transparency aspect of the image is only supported for the Image control. Because Visual FoxPro stores only one instance of that image as a resource for use internally, it is possible to use this image on another control such as a CommandButton and have it retain transparency. To do this, you first need to load the image into an Image control and persist that control (maybe hidden). Once the image has been loaded as a resource by the Image control, it can then be used by the CommandButton.

If you use the following code in button init, it will do all described above automagically
LOCAL cImg, cPict, cDownPict, cDisabledPict

cPict = this.Picture 
cDisabledPict = this.DisabledPicture 
cDownPict = this.DownPicture

IF NOT EMPTY(this.Picture)
	IF INLIST(UPPER(JUSTEXT(this.picture)),'PNG','GIF')
		cImg = 'btnImg'+JUSTSTEM(this.Picture)+JUSTEXT(this.Picture)
		IF TYPE('_screen.'+cImg) <> 'O'
			this.Picture = ''
			CLEAR RESOURCES cPict 
			_screen.AddObject( cImg,'Image')
			_screen.&cImg..Picture = cPict
			this.Picture = cPict
		ENDIF
	ENDIF   
ENDIF 		

IF NOT EMPTY(this.DisabledPicture)
	IF INLIST(UPPER(JUSTEXT(this.DisabledPicture)),'PNG','GIF')
		cImg = 'btnImg'+JUSTSTEM(this.DisabledPicture)+JUSTEXT(this.DisabledPicture)
		IF TYPE('_screen.'+cImg) <> 'O'
			this.DisabledPicture = ''
			CLEAR RESOURCES cDisabledPict
			_screen.AddObject( cImg ,'Image')
			_screen.&cImg..Picture = cDisabledPict
			this.DisabledPicture = cDisabledPict
		ENDIF  
	ENDIF 
ENDIF 		

IF NOT EMPTY(this.DownPicture)
	IF INLIST(UPPER(JUSTEXT(this.DownPicture)),'PNG','GIF')
		cImg = 'btnImg'+JUSTSTEM(this.DownPicture)+JUSTEXT(this.DownPicture)
		IF TYPE('_screen.'+cImg) <> 'O'
			this.DownPicture = '' 
			CLEAR RESOURCES cDownPict
			_screen.AddObject(cImg,'Image')
			_screen.&cImg..Picture = cDownPict
			this.DownPicture = cDownPict
		ENDIF  
	ENDIF 
ENDIF 		
>Why in VFP 9 some (not all) Gif images in Command Button become opaque (white background) and in VFP 7 the same image is transparent?
Previous
Reply
Map
View

Click here to load this message in the networking platform