13,825
社区成员
发帖
与我相关
我的任务
分享
//发送
REHistory->SelAttributes->Color=clGreen;
REHistory->Lines->Add(UserName+"("+(Now()).FormatString("yyyy-mm-dd hh:mm:ss")+")");//显示发送方名字
REHistory->SelAttributes->Color=clBlack;
REHistory->Lines->Add(" "+Trim(RESend->Text));//显示发送内容
SendMessage(REHistory->Handle, EM_SCROLLCARET, 0, 0);//显示光标所在位置
...
//接收
REHistory->SelAttributes->Color=clGreen;
REHistory->Lines->Add(sStation +" "+sName+"("+(Now()).FormatString("yyyy-mm-dd hh:mm:ss")+")");//显示对方名字
REHistory->SelAttributes->Color=clBlue;
REHistory->Lines->Add(" "+sContent);//显示接收内容
SendMessage(REHistory->Handle, EM_SCROLLCARET, 0, 0);//显示光标所在位置
TRichStreamModes set;
set<<smSelection;
//NewStyleStream是Stream,里面是RTF格式的文本(即带格式的内容)
//通Stream来中转。
DBRichEdit1->Lines->BeginUpdate();
NewStyleStream->Position = 0;
DBRichEdit1->StreamMode = set;
DBRichEdit1->Lines->LoadFromStream(NewStyleStream);
set>>smSelection;
DBRichEdit1->StreamMode = set;
DBRichEdit1->Lines->EndUpdate();