Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Reverse color of a shape
Message
 
 
To
09/03/2007 11:35:15
Bruno Maddalozzo
Informatica Aziendale
Arsie, Italy
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01202325
Message ID:
01202329
Views:
9
>I've the need to dermine the 'reverse' color of a shape to assign to a label, lying over the shape, in order to be able to read the content.
>I.e. a black color for a shape should give a white color for the label, a blu shape a yellow label and so on.
>
>The user can choose the back color of the shape and the label, automatically, should get the 'reverse color'.
>
>How can I get the result?
>TIA

Try
speccolor=Thisform.BackColor  
  	b=floor(speccolor/65536)  
  	g=floor((speccolor-m.b*65536)/256)  
  	r=floor(speccolor-m.b*65536-m.g*256)  
  	This.ForeColor=IIF(r+3*g+b>255*2.5,rgb(0,0,0),rgb(255,255,255))
From http://forum.foxclub.ru/read.php?29,254746,255048#msg-255048
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform