METHOD Colorize( nStart, nEnd, nColor ) CLASS TRichEdit
::SetSel( nStart, nEnd )
RESetCharFormat( ::hWnd, ::oFont:cFaceName, ;
Size2Font( ::oFont:nHeight ) * 20, nColor, ;
::oFont:nCharSet, ;
::oFont:nPitchFamily, ;
::oFont:nWeight, ;
::oFont:lItalic, ;
::oFont:lUnderline, ;
::oFont:lStrikeOut )
::HideSel()
return nil
METHOD ReplaceAll( lUndo, cFind, lDown, lCase, lWord, lAll, cText, lMsg ) CLASS TRichEdit5
local lSw := .T.
local nV := 0
local nPos := ::GetPos()
DEFAULT lUndo := .T.
DEFAULT lMsg := .T.
Do While lSw
lSw := ::Find( cFind, lDown, lCase, lWord )
if lSw
nV++
::ReplaceSel( lUndo, cText )
endif
Enddo
if !Empty( nV )
if lMsg
MsgInfo( "End Replace: " + StrZero( nV, 5 ) + " found" )
endif
else
MsgInfo("String not found: " + cFind )
endif
::SetPos( nPos )
return if( !Empty( nV ), .T., .F. )
#include "FiveWin.ch"
#include "RichEdit.ch"
function Main()
local cTitle:="Test"
local cResult, oMemo
Public cShowstr:=""
Public oDlg
REQUEST DBFCDX
USE clients via "DBFCDX" NEW
DEFINE FONT oFont NAME "Courier New" SIZE 8,15
DEFINE FONT oBold NAME "Courier New" BOLD SIZE 8,15
DEFINE DIALOG oDlg FROM 5,10 TO 50, 200 font oFont TITLE "Test Color"
@ 10, 10 XBROWSE oBrw OF oDlg ;
SIZE 400, 200 PIXEL ;
COLUMNS 'Name', 'Adress', 'Notes' ;
ALIAS 'CLIENTS' NOBORDER
WITH OBJECT oBrw
:nColDividerStyle := LINESTYLE_LIGHTGRAY
:nRowDividerStyle := LINESTYLE_LIGHTGRAY
:bClrRowFocus := { || { CLR_BLACK, RGB(185,220,255) } }
:nMarqueeStyle := MARQSTYLE_HIGHLROWMS
:bChange := { || oSay:refresh(),showmemo() }
:CreateFromCode()
END
@ 10,460 SAY oSay PROMPT clients->notes SIZE 200,200 PIXEL OF oDlg COLOR CLR_BLACK update //TRANSPARENT
ACTIVATE DIALOG oDlg CENTERED
close all
Return nil
function showmemo()
Local cStr:=""
local cChange:= "FiveWin" // Word that we will look for
local cInto:= "\cf2 FiveWin \cf1" // Put Word in Color
cText = alltrim(clients->notes)
cStr += "{\rtf1\ansi\deff0"
cStr += "{\colortbl;\red0\green0\blue0;\red255\green0\blue0;}"
cstr = cStr + cText
cStr += "}"
cShowStr = StrTran( cStr, cChange, cInto ) // --> "Harbour Power"
hDLL = LoadLibrary( 'riched20.dll' )
@ 250,900 RICHEDIT oMemo VAR cShowstr of oDlg PIXEL SIZE 300,400
return NIL
#include "RichEdit5.ch"
// hDLL = LoadLibrary( 'riched20.dll' ) // Not use this
@ 250,900 RICHEDIT5 oMemo VAR cShowstr of oDlg PIXEL SIZE 300,400
FUNCTION SHOWMEMO(cText, oFont, cFSeek1, cFSeek2)
LOCAL cStr := ""
LOCAL cChange := "xbrowse" // Word that we will look for
LOCAL cInto := "\highlight1 xbrowse \highlight0" // Put Word in Color
LOCAL cVar := ""
cStr += "{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang3082{\fonttbl{\f0\fnil\fcharset0 Tahoma;}}"
cStr += "{\colortbl ;\red255\green0\blue0;\red0\green0\blue0;\red128\green64\blue64;\red0\green0\blue128;}"
cStr += "\viewkind4\uc1"
cStr += "\pard\fs20" + if( Empty( cText ), " ", cText )
cStr += "}"
cStr := STRTRAN( cStr, cChange, cInto )
IF HB_ISNIL( oMemo )
@ 70, 625 RICHEDIT5 oMemo VAR cVar OF oDlg SIZE 600, 380 ; // w h
FONT oFont PIXEL HSCROLL
ENDIF
oMemo:LoadRTF( cStr, .F. )
oMemo:GoToLine( 1 )
RETURN NIL
IF HB_ISNIL( oMemo )
@ 5, 5 RICHEDIT5 oMemo VAR cVar OF oDlg SIZE 350, 300 ;
FONT oFont PIXEL //HSCROLL
oMemo:lHighlight := .t.
ENDIF
oMemo:LoadRTF( cStr, .F. )
oMemo:SetPos( 0 )
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 48 guests