Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Drucken? (https://www.delphipraxis.net/3100-drucken.html)

Chriss 23. Feb 2003 15:16


Drucken?
 
Liste der Anhänge anzeigen (Anzahl: 1)
Hi @ all!
Finde es zwar doof, zwei anfragen gleichzeitig laufen zu lassen, nur ahben die nichts miteinander zu tun. Also...
ich möchte einen Teil meines Forms ausgedruckt haben... Per Button!

Das Problem an der Sache ist, dass es zwei Dinge sein müssen...
Einmal soll das Diagramm und einmal Soll das Memo ausgedruckt werden...
Programm exe ist dabei... wie amche ich das denn?

ach ja, bitte, wenn runtergeldaen wurde, erst die Wichtig.txt lesen!

nailor 23. Feb 2003 16:50

Mit Memo drucken, meinst du da einfach den Text, der im Memo ist, oder nur den Ausschnitt, den man sieht?

Chriss 23. Feb 2003 16:58

also, einmal ALLES was im memo steht, allerding im gleichen zug auch das diagramm1

nailor 23. Feb 2003 17:03

Zum Memo:

To print the contents of a memo component:

1. Assign a text-file variable to the printer by calling AssignPrn.
2. Create and open the output file by calling Rewrite.
Any Write or Writeln statements sent to the file variable are then written on the Canvas of the printer object.

The AssignPrn procedure is declared in the Printers unit, so you must add Printers to the uses clause of the unit that calls AssignPrn.

When the printer is ready for input, you can write the contents (Lines property) of the memo to the printer.

oder:

he VCL TPrinter object encapsulates details of Windows printers. To get a list of installed and available printers, use the Printers property. The CLX TPrinter object is a paint device that paints on a printer. It generates postscript and sends that to lpr, lp, or another print command.
Both printer objects use a TCanvas (which is identical to the form's TCanvas) which means that anything that can be drawn on a form can be printed as well. To print an image, call the BeginDoc method followed by whatever canvas graphics you want to print (including text through the TextOut method) and send the job to the printer by calling the EndDoc method.

This example uses a button and a memo on a form. When the user clicks the button, the content of the memo is printed with a 200-pixel border around the page.
To run this example successfully, add Printers to your uses clause.
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);

var
  r: TRect;
  i: Integer;
begin
  with Printer do
    begin
      r := Rect(200,200,(Pagewidth - 200),(PageHeight - 200));
      BeginDoc;
      for i := 0 to Memo1.Lines.Count do
       Canvas.TextOut(200,200 + (i *
Canvas.TextHeight(Memo1.Lines.Strings[i])),
                                   Memo1.Lines.Strings[i]);
      Canvas.Brush.Color := clBlack;
      Canvas.FrameRect(r);
      EndDoc;
    end;

end;
oder:

nimm ein RichEdit, das kann man per "RichEdit1.Print" drucken...
[Edit=FuckRacism]Delphi-Tags eingefügt[/Edit]

Chriss 23. Feb 2003 17:07

und wie mache ich das mit dem diagramm

dopeline 5. Mai 2003 21:43

Ich hab da mal noch 2 Fragen:


1. wie kann ich meherere Memos hintereinander gehängt ausdrucken?

2. Wie Erstelle ich über dem Ausdruck des Memos die jeweilige bezeichnung?
z.b. beim ausdruck von memo1 steht darüber "Allgemeines" o.a.


Grüße, dopeline :dancer:

Luckie 5. Mai 2003 22:26

Nimm den Code den Nailor gepostet hat und zeichen unter den Text vom Memo das Diagramm mit den Canvas-Methoden.


Alle Zeitangaben in WEZ +1. Es ist jetzt 11:35 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz