Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Transparent Form
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01224014
Message ID:
01224221
Vues:
76
This message has been marked as the solution to the initial question of the thread.
Kevin,

IIRC, the transparency effect works for one color, so what you should do is set the background property of your form to some unique, not used in other control color, thus making only the form transparent

[Update]

Here is the effect, what happens to you, I believe, is the same as if you change the backcolor of the form to white, so in the example I choosed a close to white color for the form, but not quite
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN


	**************************************************
*-- Form:         form1 (x:\foxv\hugo\prog\transparent.scx)
*-- ParentClass:  form
*-- BaseClass:    form
*-- Time Stamp:   05/10/07 09:09:08 AM
*
DEFINE CLASS form1 AS form


	ShowWindow = 2
	DoCreate = .T.
	Caption = "Form1"
	BackColor = RGB(254,254,254)	&& changing to 255,255,255 will make the edit and text boxes transparents too
	Name = "Form1"


	ADD OBJECT command1 AS commandbutton WITH ;
		Top = 218, ;
		Left = 286, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "Exit", ;
		Name = "Command1"


	ADD OBJECT text1 AS textbox WITH ;
		Height = 23, ;
		Left = 17, ;
		Top = 14, ;
		Width = 126, ;
		Name = "Text1"


	ADD OBJECT edit1 AS editbox WITH ;
		Height = 53, ;
		Left = 17, ;
		Top = 41, ;
		Width = 124, ;
		Name = "Edit1"


	PROCEDURE Init
		#DEFINE LWA_COLORKEY	1
		#DEFINE LWA_ALPHA		2
		#DEFINE GWL_EXSTYLE		-20
		#DEFINE WS_EX_LAYERED	0x00080000

		DECLARE INTEGER SetLayeredWindowAttributes IN win32api;
		      INTEGER HWND, INTEGER crKey, INTEGER bAlpha, INTEGER dwFlags
		DECLARE INTEGER SetWindowLong IN user32.DLL ;
		   INTEGER hWnd, INTEGER nIndex, INTEGER dwNewLong
		DECLARE INTEGER GetWindowLong IN user32.DLL ;
		   INTEGER hWnd, INTEGER nIndex

		local lnFlags

		lnFlags	= BITOR(GetWindowLong(thisform.HWnd, GWL_EXSTYLE), WS_EX_LAYERED)
		SetWindowLong(thisform.HWnd, GWL_EXSTYLE, lnFlags)
		SetLayeredWindowAttributes(thisform.HWnd,thisform.backCOlor, 0, LWA_COLORKEY)
	ENDPROC


	PROCEDURE command1.Click
		thisform.Release()
	ENDPROC


ENDDEFINE
*
*-- EndDefine: form1
**************************************************
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform