本文整理自网络,侵删。
uses RichEdit;
procedure RichEditSetBackColor( // 设置RichEdit文字背景色 mRichEdit: TRichEdit; // Rich编辑框 mBackColor: TColor // 背景色 );
var vCharFormat2: TCharFormat2; begin if not Assigned(mRichEdit) then Exit; FillChar(vCharFormat2, SizeOf(vCharFormat2), 0); vCharFormat2.cbSize := SizeOf(vCharFormat2); vCharFormat2.dwMask := CFM_BACKCOLOR; vCharFormat2.crBackColor := mBackColor; mRichEdit.Perform(EM_SETCHARFORMAT, SCF_SELECTION, Longint(@vCharFormat2)); end; { RichEditSetBackColor }
function RichEditGetBackColor( // 获得RichEdit文字背景色 mRichEdit: TRichEdit // Rich编辑框 ): TColor; var vCharFormat2: TCharFormat2; begin Result := clNone; if not Assigned(mRichEdit) then Exit; FillChar(vCharFormat2, SizeOf(vCharFormat2), 0); vCharFormat2.cbSize := SizeOf(vCharFormat2); vCharFormat2.dwMask := CFM_BACKCOLOR; mRichEdit.Perform(EM_GETCHARFORMAT, SCF_SELECTION, Longint(@vCharFormat2)); Result := vCharFormat2.crBackColor; end; { RichEditGetBackColor }
来源:http://www.cnblogs.com/key-ok/p/3359689.html
相关阅读 >>
Delphi 10 seattle中使用本地通知,请使用tnotificationcenter组件
更多相关阅读请进入《Delphi》频道 >>