Please first see the functioning of the function
- Code: Select all Expand view
FW_SayTextHilite( hDC, cText, aRect, oFont, nClrText, nClrBack, aWords )
This is an example how to use:
- Code: Select all Expand view
function TestHilite()
local oWnd
local cText := "We always eat dinner together"
local aWords
local oFont, oBold, oItalic
DEFINE FONT oFont NAME "Segoe UI" SIZE 0,-22
DEFINE FONT oBold NAME "VERDANA" SIZE 0,-25 BOLD
DEFINE FONT oItalic NAME "TIMES NEW ROMAN" SIZE 0,-25 ITALIC
aWords := { { "ALWAYS", oBold, CLR_HRED, CLR_YELLOW }, ;
{ "DINNER", oItalic, CLR_GREEN, CLR_HGRAY }, ;
{ "TOGETHER", oItalic, CLR_WHITE, CLR_RED } }
DEFINE WINDOW oWnd
oWnd:SetFont( oFont )
oWnd:bPainted := <|hDC|
local aRect := GetClientRect( oWnd:hWnd )
aRect[ 2 ] += 100
FW_SayTextHilite( hDC, cText, aRect, oFont, ;
CLR_BLACK, CLR_WHITE, aWords )
return nil
>
ACTIVATE WINDOW oWnd CENTERED
RELEASE FONTS oFont, oBold, oItalic
return nil
Now you have to use this function to paint text in a cell by defining your own codeblock:
- Code: Select all Expand view
oCol:bPaintText
This codeblock is evaluated like this:
- Code: Select all Expand view
Eval( ::bPaintText, Self, hDC, cStrData, oRect:aRect, aColors, lHighLite, lSelected )