Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How can I detemine the Windows Color Settings
Message
De
21/09/1998 19:46:53
 
 
À
21/09/1998 15:41:00
Tom Kreinbring
Thomas Kreinbring & Associates
Temple City, Californie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00139212
Message ID:
00139320
Vues:
22
>I need to determine the Windows Control Panel Settings for the Selected Item Back & Fore Colors? How do I do it?

Hi Tom - I added this code to the Registry.prg that came with vfp:
DEFINE CLASS colorreg AS registry
	FUNCTION GetRGB
		LPARAMETERS cItem, nR, nG, nB		&& pass colors by reference
		* eg eNum= o.GetRGB("Hilight", @m.nR, @m.nG, @m.nB)
		LOCAL cRGB, nRetVal
		cRGB= ""
		nRetVal= THIS.GetRegKey(m.cItem, @cRGB, "Control Panel\Colors", HKEY_CURRENT_USER)
		nR= INT(VAL(m.cRGB))
		nG= INT(VAL(SUBSTR(m.cRGB, AT(" ", m.cRGB)+1)))
		nB= INT(VAL(SUBSTR(m.cRGB, RAT(" ", m.cRGB)+1)))
		RETURN m.nRetVal
	ENDFUNC

	FUNCTION ColorValue
		LPARAMETER cItem
		* eg myColor= o.ColorValue("Hilight")
		LOCAL nR, nG, nB
		IF THIS.GetRGB(m.cItem, @m.nR, @m.nG, @m.nB) = ERROR_SUCCESS
			RETURN RGB(m.nR, m.nG, m.nB)
		ELSE
			RETURN 0	&& black
		ENDIF
	ENDFUNC

ENDDEFINE
You can then do:
o=CreateObject("ColorReg")
myColour= o.ColorValue("activetitle")

This allows me to tailor colors of things like refreshable labels to the users color settings
HTH
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform