Autor Beitrag
Fighti
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 32

Win 2000 / SuSE Linux 8.2 (dualboot)
Delphi 7 Pro / Kylix 3 Pro
BeitragVerfasst: Do 12.08.04 13:48 
Hallo zusammen,
ich habe da ein kleines Problem.

Ich hab ein Image welches ich ausdrucken will. Das klappt auch nur die Graphik kommt seitenverkehr heraus. Warum??

Hier mein Code.

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
procedure Thauptform.drucken(dokname : String);
var
   rleft    : integer;
   rtop     : integer;
   dokument : String;
   bleft    : integer;
   btop     : integer;
   bwidth   : integer;
   bheight  : integer;
begin
   rleft:=150;
   rtop :=50;
   dokument:=dokname;

   printer.PrinterIndex:=-1;
   printer.BeginDoc;
   setmapmode(printer.Canvas.Handle,MM_LOMETRIC);
   with printer.Canvas do
   begin
      Font.Name:='Arial';

      pen.Width:=2;
////////////////////////////////////////////////////////////////////////////////
// Kopfzeile
////////////////////////////////////////////////////////////////////////////////
      // -
      moveto(rleft+0,-(rtop+0));
      lineto(rleft+1800,-(rtop+0));

      moveto(rleft+0,-(rtop+200));
      lineto(rleft+1800,-(rtop+200));

      moveto(rleft+0,-(rtop+120));
      lineto(rleft+1800,-(rtop+120));
      // |
      moveto(rleft+0,-(rtop+0));
      lineto(rleft+0,-(rtop+200));

      moveto(rleft+320,-(rtop+120));
      lineto(rleft+320,-(rtop+200));

      moveto(rleft+1500,-(rtop+0));
      lineto(rleft+1500,-(rtop+200));

      moveto(rleft+1800,-(rtop+0));
      lineto(rleft+1800,-(rtop+200));

      // text

      Font.Style:=[fsbold];
      font.Height:=70;
      textout(rleft+20,-(rtop+25),'Dokument: '+dokument);

      font.Height:=40;
      textout(rleft+1540,-(rtop+15),projektname);

      Font.Style:=[];

      textout(rleft+1560,-(rtop+70),projektversion);

      textout(rleft+20,-(rtop+140),formatdatetime('dd.mm.yyyy hh:nn',now));

      textout(rleft+500,-(rtop+140),'Name Vorname');

      textout(rleft+1520,-(rtop+140),'Seite 1 von 1');

////////////////////////////////////////////////////////////////////////////////
// Inhalt
////////////////////////////////////////////////////////////////////////////////
      btop:=-(rtop+2750);
      bleft:=rleft+0;
      bwidth:=karte.kartegross.Width*2;
      bheight:=karte.kartegross.Height*2;
// Die Grafik befindet sich auf dem Formular 'karte' und heisst 'kartegross'
      StretchDraw(RECT(bleft,btop,bleft+bwidth,btop+bheight),karte.kartegross.Picture.Graphic); 
   end;
   printer.EndDoc;
end;


Bin froh für jede Hilfe!!

Danke!

Moderiert von user profile iconTino: Code- durch Delphi-Tags ersetzt.
NeWsOfTzzz
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 233


D4 Prof
BeitragVerfasst: Do 12.08.04 15:51 
Dann dreh das Bild bevor du es ausdruckst um! :roll:
Fighti Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 32

Win 2000 / SuSE Linux 8.2 (dualboot)
Delphi 7 Pro / Kylix 3 Pro
BeitragVerfasst: Fr 13.08.04 07:16 
Und wie mach ich das???
Matthias-K
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 271

Win95, Win98, Win2000, WinXP, Linux
D2, D4 Client/Server, D5 Enterprise, D6 Enterprise, D7 Enterprise, Delphi2005, C/C++ 3.0, C/C ++ 5.0, C/C++ 6.0
BeitragVerfasst: Fr 13.08.04 11:28 
NeWsOfTzzz hat folgendes geschrieben:
Dann dreh das Bild bevor du es ausdruckst um! :roll:


*lol* echt eine antwort, die ihm hilft!!! :D

versuch mal das:
ausblenden EDH-Lösung
1:
2:
3:
4:
5:
6:
7:
procedure PrintBitmap(aGraphic: TGraphic, Title: string);
begin
  Printer.Title:=Title;
  Printer.BeginDoc;
  Printer.Canvas.Draw(0,0,aGraphic);
  Printer.EndDoc;
end;


Der erste Parameter ist das zu druckende Bild. Dies kann sowohl von Typ TBitmap, TIcon, TMetaFile, oder aber auch von anderen Nachfahren von TGraphic sein, wie TJpegImage aus der Unit JPEG.
Der zweite Parameter gibt der Titel des Druckauftrags an, der im Druckmanager angezeigt wird.

also diese funktion benutze ich, wenn ich irgendwie grafiken drucken will, hatte auch noch nie probleme damit!

mfg matthias[/delphi]
Fighti Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 32

Win 2000 / SuSE Linux 8.2 (dualboot)
Delphi 7 Pro / Kylix 3 Pro
BeitragVerfasst: Fr 13.08.04 12:25 
@Mathias-K:
danke schon mal für deine Information. nur wie kann ich dann zusätzlich noch text ausdrucken?

mir ist klar das dies mit textout() geht. aber ich möchte eben eine ganze "kopfzeile" ausgeben. wie kann ich die dann "berechnen" das sie immer gleich ausgedruckt wird, egal aufg welchem drucker?

danke für die antworten.

ps: wenn du nicht genau verstehst was ich meine dann schreib mir doch dammit ichs nochmals besser formulieren kann.
NeWsOfTzzz
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 233


D4 Prof
BeitragVerfasst: Fr 13.08.04 14:20 
Meine Antwort war auch nicht direkt ernst zu nehmen, darum auch der Smilie ^^
Aber eigentlich, wenn er das BMP in ein 2d Array eingelesen hätte und in ein anderes Array verkehrt herum kopiert hätte...
Matthias-K
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 271

Win95, Win98, Win2000, WinXP, Linux
D2, D4 Client/Server, D5 Enterprise, D6 Enterprise, D7 Enterprise, Delphi2005, C/C++ 3.0, C/C ++ 5.0, C/C++ 6.0
BeitragVerfasst: Fr 13.08.04 15:27 
ich frage mich, was du mit dem bild drehen willst!
lass es doch einfach so!

vieleicht würe für dich das richtige, wenn du einen report zum drucken verwenden würdest!

weill dann könntest du dir den ganzen spaß mit dem textout usw. sparen.

mfg matthias
Fighti Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 32

Win 2000 / SuSE Linux 8.2 (dualboot)
Delphi 7 Pro / Kylix 3 Pro
BeitragVerfasst: Mo 16.08.04 11:55 
Ja das habe ich mir auch schon überlegt. nur das Problem ist ich hab keine ahnung von reports.

kennst du da eventuel ein gutes tutorial???
Fighti Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 32

Win 2000 / SuSE Linux 8.2 (dualboot)
Delphi 7 Pro / Kylix 3 Pro
BeitragVerfasst: Mo 16.08.04 13:42 
Hab soeben selbst herausgefunden an was mein versuch gescheitert ist.

trotzdem danke für eure mithilfe.

PS:
die lösung für mein Problem ist eigentlich ganz eifach, man muss den height wert de bildes einfach *-1 rechnen damit er negativ ist, da ja die vertikale einer canvas welche mit millimeter rechnet auch negativ ist.