Autor Beitrag
Bela Urlaub
ontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 453

WinXP Prof/Home, Win98SE (nur auf Server)
D6 Pers
BeitragVerfasst: Mi 19.03.03 18:18 
Hallo,
Ich hab erst vor ein paar Tagen mit Delphi angefangen und hab auch schon ein Problem. Ich habe meinem eigen Editor eine Druckfunktion gegeben. Der Druckdialog kommt, aber es druckt nicht.
Was muss ich machen?!
Bitte bald drauf antworten, brauche es dringend!
Tschuuuusss!
Tobias

_________________
mensch, menschen können auch probleme haben...
Andreas L.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: Mi 19.03.03 18:22 
Hi,
das müsste gehen:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
procedure TForm1.Button1Click(Sender: TObject);
var 
Line: Integer; 
PrintText: TextFile; 
begin 
if PrintDialog1.Execute then 
begin 
AssignPrn(PrintText); 
Rewrite(PrintText); 
Printer.Canvas.Font := Memo1.Font; 
for Line := 0 to Memo1.Lines.Count - 1 do 
Writeln(PrintText, Memo1.Lines[Line]); 
CloseFile(PrintText); 
end;
end;


Zuletzt bearbeitet von Andreas L. am Mi 19.03.03 18:28, insgesamt 1-mal bearbeitet
derDoc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 623

Win Vista Prof
D2007 Prof
BeitragVerfasst: Mi 19.03.03 18:23 
Wenn du ein RichEdit benutzt einfach RichEdit1.Print benutzten und vorher den PrintDialog aufrufen.

Wenn du ein Memo benutzt, musst du die Unit Printers einfügen und folgenden Quellcode in eine Clickprocedure einbauen:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
var
  zeile: Integer;
  drucktext: TextFile;          //Textvariable
begin
  if PrintDialog1.Execute then
    begin
      Memo1.WordWrap := false;  //Zeilenumbruch verhindern
      AssignPrn(drucktext);     //dem Drucker zuweisen
      Rewrite(drucktext);
      Printer.Canvas.Font := Memo1.Font; //Druckerschrift = Memoschrift
      for zeile := 0 to Memo1.Lines.Count - 1 do
        Writeln(drucktext, Memo1.Lines[zeile]);//Textvariable beschreiben
      CloseFile(drucktext);     //Variable schließen
    end;
end;

_________________
MfG derDoc
There are only 10 types of people: those who understand binary and those who don't.
derDoc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 623

Win Vista Prof
D2007 Prof
BeitragVerfasst: Mi 19.03.03 18:24 
@onlinehome:
Ich glaube wir haben die selbe Quelle.

_________________
MfG derDoc
There are only 10 types of people: those who understand binary and those who don't.
Andreas L.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: Mi 19.03.03 18:28 
derDoc hat folgendes geschrieben:
@onlinehome:
Ich glaube wir haben die selbe Quelle.


Ja, ich hab es aus nen früheren Beitrag von mir! Da hab ich gefragt wies geht! Und jetzt kann ichs weitererzählen! *g*
Bela Urlaub Threadstarter
ontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 453

WinXP Prof/Home, Win98SE (nur auf Server)
D6 Pers
BeitragVerfasst: Mi 19.03.03 18:33 
Titel: Danke LeutZ!!!!
Danke, ich hoffe, dass ich des jetzt hinkrieg!!
Wenn wieder ein Prob. sein sollte, schreib ich einfahc wieder was...

Tschuss!!!
'Tobias

_________________
mensch, menschen können auch probleme haben...
Andreas L.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: Mi 19.03.03 18:34 
Kein Problem dafür sind wir doch da! Gel Bela! *g*
Bela Urlaub Threadstarter
ontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 453

WinXP Prof/Home, Win98SE (nur auf Server)
D6 Pers
BeitragVerfasst: Mi 19.03.03 18:36 
Titel: Jaja...
8) Jaja... onlinehome, des wär auch anders gegangen... :!:

_________________
mensch, menschen können auch probleme haben...
Andreas L.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: Mi 19.03.03 18:37 
Schon, aber ICQ is billig! :wink: