Sample: fwh\samples\xbfntclr.prg
- Code: Select all Expand view
- /*
* XBrowse
* Different lines in different fonts and colors
*
*/
#include "fivewin.ch"
REQUEST DBFCDX
//----------------------------------------------------------------------------//
function Main()
field STATE,CODE
local oDlg, oFont, oBrw
local aFont1[ 2 ], aFont2[ 4 ]
USE STATES NEW SHARED VIA "DBFCDX"
INDEX ON CODE TAG CODE TO TMP MEMORY
SET ORDER TO TAG CODE
USE CUSTOMER NEW ALIAS CUST SHARED VIA "DBFCDX"
SET RELATION TO STATE INTO STATES
GO TOP
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
DEFINE FONT aFont1[ 1 ] NAME "VIVALDI" SIZE 0,-30
DEFINE FONT aFont1[ 2 ] NAME "Verdana" SIZE 0,-20
DEFINE FONT aFont2[ 1 ] NAME "TIMES NEW ROMAN" SIZE 0,-18
DEFINE FONT aFont2[ 2 ] NAME "TAHOMA" SIZE 0,-16 BOLD
DEFINE FONT aFont2[ 4 ] NAME "TAHOMA" SIZE 0,-16 ITALIC BOLD
DEFINE DIALOG oDlg SIZE 700,800 PIXEL TRUEPIXEL FONT oFont ;
TITLE "FWH16.11: XBROWSE Multiple Fonts and Colors"
@ 20,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg DATASOURCE "CUST" ;
COLUMNS "TRIM(FIRST) + CHR(13)+CHR(10) + LAST", ;
"TRIM(STREET) + CHR(13)+CHR(10) + TRIM(CITY) +CHR(13)+CHR(10) + TRIM(ZIP) + CHR(13)+CHR(10) + TRIM(STATES->NAME)", ;
"TRIM(FIRST) + CHR(13)+CHR(10)+TRIM(LAST)" ;
HEADERS "NAME", "ADDRESS", "CUSTOMER" ;
JUSTIFY AL_CENTER, AL_CENTER, AL_CENTER ;
LINES NOBORDER
WITH OBJECT oBrw
:nRowHeight := 100
:nWidths := { 200, 250, 150 }
:nHeadStrAligns:= AL_CENTER
:nStretchCol := 2
:lFitGridHeight:= .t.
WITH OBJECT :name
:aDataFont := aFont1
:aClrText := { CLR_HBLUE, CLR_HRED }
END
WITH OBJECT :address
:aDataFont := aFont2
:aClrText := { nil, CLR_HRED, nil, CLR_GREEN }
END
WITH OBJECT :aCols[ 3 ]
:nDataStrAlign := AL_LEFT + AL_BOTTOM
:bStrImage := { || "c:\fwh\bitmaps\olga1.jpg" }
:aImgRect := { nil, 0.3, 0.7, nil, "CIRCLE" }
END
//
:CreateFromCode()
END
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont
AEval( aFont1, { |o| If( o == nil,,o:End() ) } )
AEval( aFont2, { |o| If( o == nil,,o:End() ) } )
return nil
//----------------------------------------------------------------------------//
This sample also shows how to compose text and image in the same cell using text alignment and DATA aImgRect