Reputation: 305
I am using the following code to highlight a selection of text in a RichEdit.
procedure TAFormatMain.BtHighLightTextClick(Sender: TObject);
const
AColor = clYellow;
var
Format: CHARFORMAT2;
begin
FillChar(Format, SizeOf(Format), 0);
with Format do
begin
cbSize := SizeOf(Format);
dwMask := CFM_BACKCOLOR;
crBackColor := AColor;
RiEd.Perform(EM_SETCHARFORMAT, SCF_SELECTION, Longint(@Format));
end;
RiEd.SelStart := RiEd.SelStart + RiEd.SelLength;
end;
Can anybody tell me how to remove the highlight or what the colour value for "no colour" (equivalent to No Colour in Microsoft Word) would be. I could not find any relevant information about this topic on the net.
Upvotes: 0
Views: 589
Reputation: 21242
To rest the background color set:
Format.dwEffects := CFE_AUTOBACKCOLOR;
Format.dwMask := CFM_BACKCOLOR;
See also: CHARFORMAT2 structure
Upvotes: 2