Autor Beitrag
Coder
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1383
Erhaltene Danke: 1

WinXP
D2005 PE
BeitragVerfasst: So 09.01.05 20:19 
Hi
Ich will den Text eines RichEdits in ein anderes RichEdit kopieren und vor jede Zeile ein > setzen.
ausblenden Delphi-Quelltext
1:
for Item := 0 to Editor1.Lines.Count - 1 do RichEdit2.Lines.Add('>' + Editor1.Lines[Item]);					

Damit wird zwar der Text kopiert aber nicht die Textatribute. :?

Wie kann ich den Text sammt Atribute kopieren?
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: So 09.01.05 20:29 
2 Möglichkeiten:
über die Zwischenablage (find ich aber nicht so gut)
einen Memorystream erstellen und mit richedit.lines.savetostream und loadfromstream das richedit kopieren. vorm laden drauf achten, das du die position im stream wieder auf 0 setzt

Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
Coder Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1383
Erhaltene Danke: 1

WinXP
D2005 PE
BeitragVerfasst: So 16.01.05 18:29 
Thx, hab mich für den Stream entschieden.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
var  Stream1: TMemoryStream;

  Stream1 := TMemoryStream.Create;
  RichEdit1.Lines.SaveToStream(Stream1);
  Stream1.Position := 0;
  RichEdit2.Lines.LoadFromStream(Stream1);
  Stream1.Free;