Autor Beitrag
Soapy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 88

Windows 2000
Delphi 2005 Personal
BeitragVerfasst: So 30.12.07 17:10 
Hallo Delphi-Gemeinde

Ich habe ein Problem.
Und zwar habe ich ein Programm geschrieben, das lineare Funktionen berechnet und diese dann ausdruckt.
Das Programm errechnet die lineare Funktion, und stellt sie in einem TImage dar, das ich zusätzlich noch mit einem Koordinatensystem ausgestattet habe.
So klappt alles einwandfrei, druckt auch aus aber leider im Hochformat, sodass immer nur ein Teil der linearen Funktion und des Koordinatensystems angezeigt wird.

Das ist meine Druckroutine:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
with Printer do
  begin
    BeginDoc;
    try
      ScaleX := GetDeviceCaps(Handle, logPixelsX) div PixelsPerInch;
      ScaleY := GetDeviceCaps(Handle, logPixelsY) div PixelsPerInch;
      RR := Rect(00, Koordinatensystem.picture.Width * scaleX, Koordinatensystem.Picture.Height * ScaleY);
      Canvas.StretchDraw(RR, Koordinatensystem.Picture.Graphic);
    finally
      EndDoc;   //Methode EndDoc beendet den aktuellen Druckauftrag und schließt die
    end;
end;


Wie kann ich nun einstellen, dass der Drucker das TImage im Querformat ausdruckt?

Und zum Schluss noch das Programm für euch:


Moderiert von user profile iconjasocul: Topic aus Delphi Language (Object-Pascal) / CLX verschoben am So 30.12.2007 um 17:59
DrRzf
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 260

Win XP Prof
D7 Enterprise
BeitragVerfasst: So 30.12.07 17:28 
ausblenden Delphi-Quelltext
1:
Printer.Orientation := poLandscape;					

_________________
rein statistisch gesehen darf man keiner statistik trauen die man nicht selbst gefälscht hat.
Soapy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 88

Windows 2000
Delphi 2005 Personal
BeitragVerfasst: So 30.12.07 17:30 
Ich probiers mal aus!
Danke!

P.S. Ich weiß dass ich mit meinen vielen Posts langsam nerve :? , aber ich denke dass das auch andere interessieren kann... :?:
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6393
Erhaltene Danke: 147

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: So 30.12.07 18:59 
user profile iconSoapy hat folgendes geschrieben:
P.S. Ich weiß dass ich mit meinen vielen Posts langsam nerve
So ein Quatsch. Du nervst nicht. Das würdest du schon merken, wenn es so wäre.
Soapy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 88

Windows 2000
Delphi 2005 Personal
BeitragVerfasst: So 30.12.07 23:51 
Schön :D

Aber ich hab nochmal ein Problem...
Vorher hat es mir mein Koordinatensystem querformatig ausgedruck, so wie ich es wollte.
Das ist der Code:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
procedure TLineareFunktionen.Print1Click(Sender: TObject);
var 
  ScaleX, ScaleY: Integer; 
  RR: TRect;
begin
  with Printer do
    begin
      BeginDoc;
      try
        ScaleX := GetDeviceCaps(Handle, logPixelsX) div PixelsPerInch;
        ScaleY := GetDeviceCaps(Handle, logPixelsY) div PixelsPerInch;
        RR := Rect(00, Koordinatensystem.picture.Width * scaleX, Koordinatensystem.Picture.Height * ScaleY);
        Canvas.StretchDraw(RR, Koordinatensystem.Picture.Graphic);
      finally
        EndDoc;
      end;
    Orientation := poLandscape;
  end;
end;


Jetzt habe ich den Code so geändert:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
procedure TLineareFunktionen.Print1Click(Sender: TObject);
var 
  ScaleX, ScaleY: Integer; 
  RR: TRect;
  s: string;
begin
  s := Ergebnis.Text;
  Koordinatensystem.Canvas.TextOut(10,10, s);
  with Printer do
    begin
      BeginDoc;
      try
        ScaleX := GetDeviceCaps(Handle, logPixelsX) div PixelsPerInch;
        ScaleY := GetDeviceCaps(Handle, logPixelsY) div PixelsPerInch;
        RR := Rect(00, Koordinatensystem.picture.Width * scaleX, Koordinatensystem.Picture.Height * ScaleY);
        Canvas.StretchDraw(RR, Koordinatensystem.Picture.Graphic);
      finally
        EndDoc;
      end;
    Orientation := poLandscape;
  end;
end;


Jetzt druckt es mir zwar mein Ergebnis.Text in das Textout im Koordinatensystem aber wieder hochformatig!!! :evil:

Ich versuche jetzt seit 3-4 Stunden das zu lösen, damit es mir wieder querformatig ausdruck... :evil:

Ich verzweifel noch an diesem Programm :cry:

Bitte helft mir :?:
DrRzf
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 260

Win XP Prof
D7 Enterprise
BeitragVerfasst: Mo 31.12.07 00:44 
du drehst das format auch erst nach dem ausdruck.

_________________
rein statistisch gesehen darf man keiner statistik trauen die man nicht selbst gefälscht hat.
Soapy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 88

Windows 2000
Delphi 2005 Personal
BeitragVerfasst: Mo 31.12.07 11:11 
Ich habs vorher versucht und da hats geklappt!
Naja danke für den Tipp...
Soapy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 88

Windows 2000
Delphi 2005 Personal
BeitragVerfasst: Mo 31.12.07 15:14 
Hey geil... Danke!
Des funktioniert!