There is a Font unreleased at TRichEdit class:
FONT,-1744171655,TRICHEDIT:REDEFINE(391)->MAIN(36)
This is a working simple:
- Code: Select all Expand view RUN
- #Include "FiveWin.ch"
#include "richedit.ch"
//----------------------------------------------------------------------------//
Function Main()
Local oDlg, oRich, cRtf := ""
Local hRichDLL := LoadLibrary( "riched20.dll" )
local lBold := .F., nPos := 0
// Debug Checkres
FErase("checkres.txt")
SetResDebug( .T. )
cRtf:="{\rtf1\ansi\deff0{\fonttbl{\f0\fnil\fcharset0 Courier New;}}"+CRLF+;
"{\colortbl ;\red0\green77\blue187;\red192\green80\blue77;}"+CRLF+;
"{\*\generator Msftedit 5.41.21.2510;}\viewkind4\uc1\pard\cf1\lang1031\f0\fs22 This is \b colored \b0 text\cf0 . \cf2 The background is color 1 and the foreground is color 2\cf0\par"+CRLF+CRLF+;
"}"
DEFINE DIALOG oDlg NAME "Test"
REDEFINE RICHEDIT oRich VAR cRTF OF oDlg ID 100
//oRich:lHighLight = .f.
REDEFINE BUTTON ID 110 ACTION ( oRich:LoadFromRTFFile( cGetFile( "Archivo RTF (*.rtf) | *.rtf" ), oRich:SetFocus() ) )
REDEFINE BUTTON ID 120 ACTION ( lBold := ! lBold, ;
oRich:SetBold( lBold ), oDlg:Update(), oRich:SetFocus(), oDlg:cTitle := "IsBold "+cValtoChar(lBold) )
oRich:SetText( cRtf )
//oRich:bGotFocus = { || oRich:HideSel(), oRich:SetSel( nPos, nPos ) }
//oRich:bLostFocus = { || nPos := oRich:GetPos() }
ACTIVATE DIALOG oDlg CENTERED
FreeLibrary( hRichDLL )
/* CheckRes Recursos FWH*/
CheckRes()
WinExec("notepad checkres")
Return nil
Thank you.