Hello Sergey,
I have to highlight some special words when user types them into the editor immediately, but I do not want to modify the user defined style.
I have tried the Search&Mark demo, but it modifies the Style so it does not help.
For example: BLABLA BLABLA SPECIALFIELD BLABLA BLABLA
I would like to draw custom background for SPECIALFIELD text, and keep the original style of rest of them. I am playing with the OnDrawTextBack of TRVStyle. It looks like this is what I need. The Left, Top... params contain information about the whole string, and I was not able to find out how to determine the exact position of the SPECIALFIELD word in the RichEdit control.
Is it possible to calculate it any way?
Thanks,
Lajos Farkas
My code is here:
procedure Tfrm_Main.RVEditorStyleDrawTextBack(Sender: TRVStyle; Canvas: TCanvas; StyleNo, Left, Top, Width, Height: Integer; DrawState: TRVTextDrawStates; var DoDefault: Boolean);
Var
I: Integer;
ItemText: String;
ItemTag: Integer;
Begin
ItemText:=TCustomRVFormattedData(Sender.RVData).GetItemText(Sender.ItemNo );
If ItemText='' Then Exit;
If FHelpStorage.LiveTextList.IsValidField( ItemText ) Then
Begin
Canvas.Brush.Color:=clLime;
Canvas.Brush.Style:=bsSolid;
Canvas.Pen.Style:=psSolid;
Canvas.Pen.Color:=clLime;
Canvas.Rectangle( Left, Top, Left + Width, Top + Height);
End;
Highlight Paragraph Substring
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact: