RSS订阅 | 匿名投稿
您的位置:网站首页 > 组件 > 正文

delphi RichEdit文字背景色的处理

作者:admin 来源: 日期:2018/3/14 11:39:22 人气: 标签:

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

读完这篇文章后,您心情如何?
0
0
0
0
0
0
0
0
本文网址:
下一篇:没有资料