procedure TFrmMessageM.ShowChatMsg(const rchvwdtInfo: TRichViewEdit;const id: Int64; const SenderName,
  SenderNotice, ReciveName, ReciveNotice: string; const DT: TDateTime;
  const Stream: TMemoryStream;const MemberID:Integer);
var
  wsName,wsNick,wsRe:WideString;
  Flag:Integer;
  wsStr:WideString;
  CheckBox:TRzCheckBox;
  r:Boolean;
  tmplist:TStringlist;
begin
  FrmMain.MemberInfo.GetMemberInfo(FrmMain.ToocleX1.LogUserID,nil,@wsName,@wsNick);
  CheckBox:=TRzCheckBox.Create(nil);
  CheckBox.Hint := IntToStr(id);
  CheckBox.Color := CLWHITE;
  CheckBox.Width :=CheckBox.Height;
  CheckBox.Tag := 99;
  rchvwdtInfo.AddControlExTag('checkbox',CheckBox,0,rvvaAbsMiddle,99);
  if (wsNick= SenderNotice) or (wsName=SenderName) then Flag:=0
  else Flag:=4;
  wsStr := '游客';
  if Flag <>0 then
  begin
    if MemberID<>0 then
      FrmMain.MemberInfo.GetMemberInfo(MemberID,nil,nil,nil,nil,nil,nil,nil,nil,@wsRe);
  end;
  if wsRe<>'' then  wsStr:=  wsRe
  else if ''<>SenderNotice then wsStr := SenderNotice
  else wsStr := SenderName;
  if (Flag<>0) and (wsStr='') then wsStr:=IntToStr(Memberid);
  rchvwdtInfo.ReadOnly:=False;
  if Flag=0 then
  begin
    if FormatDateTime('yyyy-MM-dd',Now)=FormatDateTime('yyyy-MM-dd',DT) then
      rchvwdtInfo.AddNLWTag(wsStr+'说: '+FormatDateTime('hh:mm:ss',DT)+'   ',5,-1,0)
    else
      rchvwdtInfo.AddNLWTag(wsStr+'说: '+FormatDateTime('yyyy-MM-dd hh:mm:ss',DT)+'   ',5,-1,0);
  end
  else
  begin
    if FormatDateTime('yyyy-MM-dd',Now)=FormatDateTime('yyyy-MM-dd',DT) then
      rchvwdtInfo.AddNLWTag(wsStr+'说: '+FormatDateTime('hh:mm:ss',DT)+'   ',4,-1,0)
    else
      rchvwdtInfo.AddNLWTag(wsStr+'说: '+FormatDateTime('yyyy-MM-dd hh:mm:ss',DT)+'   ',4,-1,0);
  end;
  Stream.Position:=0;
  rchvwdtInfo.AddTextNLA('    ',4,0,0);
 // rchvwdtInfo.AppendRVFFromStream(Stream,-1);
  try
    if not rchvwdtInfo.AppendRVFFromStream(Stream,-1) then//从这一句下面就很明白
    begin
      tmplist:= TStringlist.Create;
      try
        Stream.Position:=0;
        tmplist.LoadFromStream(Stream);
        rchvwdtInfo.AddNLWTag(tmplist.Text,3,-1,0);
        rchvwdtInfo.Format;
        DM.ReplaceStrToFace(rchvwdtInfo,StrToWideStr(tmplist.Text));
      finally
        freeandnil(tmplist);
      end;
    end
    else
    begin
      if rchvwdtInfo.Tag=0 then
      begin
        rchvwdtInfo.Format;
        DM.ReplaceCharToFace(rchvwdtInfo,0,true);
      end;
    end;
  except
    on e:Exception do
    begin
      DM.WriteLog(e.Message,-1);
    end
  end;
  if rchvwdtInfo.Tag=0 then
  begin
    //rchvwdtInfo.Format;
   // DM.ReplaceCharToFace(rchvwdtInfo,0,true);
    rchvwdtInfo.Format;
    rchvwdtInfo.ReadOnly:=True;
    rchvwdtInfo.Format;    rchvwdtInfo.SetSelectionBounds(0, rchvwdtInfo.GetOffsBeforeItem(0),0, rchvwdtInfo.GetOffsBeforeItem(0));
    r:=ScanURLs(rchvwdtInfo.RVData,rchvwdtInfo.Style,True);   //扫描是否有网站的超链接
    if r then rchvwdtInfo.Format;
  end;
  PostMessage(rchvwdtInfo.Handle,WM_VSCROLL,SB_BOTTOM,0);
end;