>>>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>
>
>It doesn't work (only gets black or white).
>Any other ideas?
>
>TIA
Yes, that was the idea to get maximum contrast.
If it's not broken, fix it until it is.
My Blog