2016-11-08 79 views
0

我使用以下代碼突出顯示RichEdit中的文本選擇。刪除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; 

任何人都可以告訴我如何刪除高亮或「無顏色」(相當於Microsoft Word中沒有顏色)的顏色值。我無法在網上找到關於此主題的任何相關信息。

回答

2

休息的背景色設置:

Format.dwEffects := CFE_AUTOBACKCOLOR; 
Format.dwMask := CFM_BACKCOLOR; 

參見:CHARFORMAT2 structure

相關問題