如何改变bcb5 中richedit一行的背景颜色。

xie_zm 2002-04-04 05:22:10
如何改变bcb5 中richedit一行的背景颜色。这个不是字符的背景颜色,而是一整行的背景颜色,包括了字符和空格字符,象ultraedit中输入的背景颜色。或者有什么其他的编辑控件可以实现该功能。
...全文
303 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
李志林HZ 2002-10-15
  • 打赏
  • 举报
回复
gz!
李志林HZ 2002-10-10
  • 打赏
  • 举报
回复
我都试过了,好象不可以的样子!
invalid 2002-04-06
  • 打赏
  • 举报
回复
Indicates the foreground color of the text.
看看帮助怎么说吧。
__property Graphics::TColor Color = {read=GetColor, write=SetColor, nodefault};

Description

Use color to indicate the color of the actual characters. the background color is a property of the rich edit control that uses the TTextAttributes object, and should be set by the Color property of the rich edit control.
xie_zm 2002-04-05
  • 打赏
  • 举报
回复
谢谢你们了,但我所要的是一整行的背景颜色,并非字体颜色。就像选中的黑色背景,白色字体。
wallacechao 2002-04-05
  • 打赏
  • 举报
回复
你用FIELDS里进行设置应该就可以了
invalid 2002-04-04
  • 打赏
  • 举报
回复
简单的说就是设置RichEdit的
SelAttributes->Color = clRed;
然后加入就可以,也可以选中一行后设置。
invalid 2002-04-04
  • 打赏
  • 举报
回复
下面的代码是分别以红色和蓝色显示信息在RichEdot中。
memoSocket是个RichEdit控件
//---------------------------------------------------------------------------
void __fastcall TformMain::AddMessage(AnsiString msg)
{
//自定义的memo显示函数,避免由于memo中的显示行数超过内存限制
if(memoSocket->Lines->Count>=MAXMEMOLINE)
{
if(Logfile)
fprintf(Logfile,"%s\n",memoSocket->Lines->Strings[0].c_str());
memoSocket->Lines->Delete(0);
}
memoSocket->SelAttributes->Color = clBlue;
memoSocket->Lines->Add(msg);
}
//---------------------------------------------------------------------------
void __fastcall TformMain::AddErrMessage(AnsiString msg)
{
//自定义的memo显示函数,避免由于memo中的显示行数超过内存限制
if(memoSocket->Lines->Count>=MAXMEMOLINE)
{
if(Logfile)
fprintf(Logfile,"%s\n",memoSocket->Lines->Strings[0].c_str());
memoSocket->Lines->Delete(0);
}
memoSocket->SelAttributes->Color = clRed;
memoSocket->Lines->Add(msg);

}

13,873

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧