I can force to gray color, but there are many different tones of gray and depending what color is that (bright or dark color). Then I should use accordingly to the right tone of gray. That's the problem.
Upto till now...
Because I found a way, not only with backcolor's labels also with any colours. A simple solution I fund with this:
Code: Select all
Function ChngToGray(aColor)
Local nGray:=(aColor[1]+aColor[2]+aColor[3])/3
Return {nGray,nGray,nGray}
See this demo:
Code: Select all
#include "hmg.ch"
Function Main
DEFINE WINDOW Form_1 ;
AT 0,0 ;
WIDTH 230 HEIGHT 130 ;
TITLE "HMG Demo" ;
MAIN ;
FONT "Arial" SIZE 10 BACKCOLOR YELLOW
DEFINE LABEL Label_9
ROW 20
COL 24
WIDTH 90
HEIGHT 20
VALUE "Test"
FONTNAME "Arial"
FONTSIZE 9
BACKCOLOR BLUE
FONTCOLOR Nil
END LABEL
DEFINE BUTTON Button_3
ROW 70
COL 103
WIDTH 100
HEIGHT 28
ACTION {|| Form_1.Label_9.BackColor := ChngToGray(Form_1.Label_9.BackColor)}
CAPTION "Enabled Label_9"
FONTNAME "Arial"
FONTSIZE 9
TOOLTIP ""
END BUTTON
END WINDOW
CENTER WINDOW Form_1
ACTIVATE WINDOW Form_1
Return Nil
Function ChngToGray(aColor)
Local nGray:=(aColor[1]+aColor[2]+aColor[3])/3
Return {nGray,nGray,nGray}
<WindowName>.<ControlName>.Enabled := .F.
I hope, all of you enjoy it !