2009-12-31 7 views

답변

3

당신은 마지막 줄 자체, 또는 전체 내용을 사용할 수 있습니다. RichEdit.Text를 읽고 쓰는 것은 메모리에서 많은 텍스트를 움직일 수 있습니다.

편집 : 내 대답에 영업 이익의 코멘트 후 :

적용 SelLength 및 SelAttributes을 사용 후, 텍스트의 서식을 추가하기 전에 SelStart를 저장하고 서식 :

// StarPos and Len are both Integers. 
StartPos := Length(RE.Text); 
Len := Length(YourNewTextToBeAdded); 
// Do stuff here to add text 
RE.SelStart := StartPos; 
RE.SelLength := Len; 
RE.SelAttributes.Style := RE.SelAttributes.Style + [fsBold]; 
+0

나는 그것을 시험해 보았다. 고마워. 하지만 이제 어떻게이 추가 된 텍스트의 서식을 지정할 수 있습니다. –

1

"문자열"및 "개수"속성을 사용할 수 있습니다.

RichEdit1.Lines.Strings [RichEdit1.Lines.Count-1] : = RichEdit1.Lines.Strings [RichEdit1.Lines.Count-1] + 'Text'; 첫 번째 방법은 RichEdit의는 많은 양의 텍스트가 들어 특히 더 나은 것을

// RE = TRichEdit, Temp = string; 
// Last line only 
Temp := RE.Lines[RE.Lines.Count - 1]; 
Temp := Temp + ' plus some new text'; 
RE.Lines[RE.Lines.Count - 1] := Temp; 

// The entire content 
Temp := RE.Text; 
Temp := Temp + ' plus some new text'; 
RE.Text := Temp; 

참고 :

+0

Lines.Strings []와 Lines []는 동일한 항목입니다. Lines는 Lines.Strings를 읽고 쓰는 기본 속성입니다. –

1

수행

with RichEdit1 do 
begin 
Lines.Add(s); 
Perform(EM_SCROLL, SB_LINEDOWN, 0); 
end; 
관련 문제