Autor Beitrag
Ice
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 114



BeitragVerfasst: Mo 10.02.03 15:23 
Hallo ihr,

ich möchte gerne Text aus einem memofeld mit Hilfe eines Printdialoges drucken, und mache das bis jetzt so:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure TForm1.drucken1Click(Sender: TObject);
begin
 with PrintDialog1 do
  begin
   if Execute then
  end;
end;

meine Frage lautet nun: Was muss ich hinter dem then schreiben um den text des Memofeldes zu drucken?

Vielen Dank im voraus

mfg Ice

Moderiert von user profile iconTino: Code-Tags hinzugefügt.
smiegel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 992
Erhaltene Danke: 1

WIN 7
D7 Prof., C#, RAD XE Prof.
BeitragVerfasst: Mo 10.02.03 15:44 
Hallo,

das Memo kann nicht drucken! Dies musst Du selber machen.

Folgend die einfachste Variante:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
procedure DruckeMemo(aMemo:TMemo);
var
  PrnFile: TextFile;
  i:integer;
begin
  AssignPrn(PrnFile);
  Rewrite(PrnFile);
  for i:=0 to aMemo.Lines.Count-1 do Writeln(PrnFile, aMemo.Lines[i]);
  System.CloseFile(PrnFile);
end; // DruckeMemo


procedure TForm1.drucken1Click(Sender: TObject); 
begin 
  with PrintDialog1 do 
    if Execute then DruckeMemo(Memo1);
end;


Eine andere Möglichkeit besteht darin, das Memo durch ein RichEdit zu ersetzten. Das RichEdit kennt eine Methode Namens Print.

_________________
Gruß Smiegel
Ich weiß, daß ich nichts weiß, aber ich weiß mehr als die, die nicht wissen, daß sie nichts wissen. (Sokrates)
Ice Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 114



BeitragVerfasst: Mo 10.02.03 16:09 
Vielen Dank geht super!

:D

mfg
Ice