Autor Beitrag
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 08.01.09 21:31 
Überleg mal was du machst. Du erstellst eine neue Bitmap der selben Größe wie dein TImage in FormCreate.

Beim Drucken zeichnest du dann zuerst den Inhalt deines TImage in unveränderter Größe und dann skaliert die leere (!) Bitmap. Denn in bmp hast du ja nix gezeichnet. Also überpinselst du den Inhalt von TImage gleich wieder auf dem Druckcanvas.
Tony-S Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 184
Erhaltene Danke: 6

Windows 7, XP, Ubtuntu
Delphi 7, Visual Basic.net
BeitragVerfasst: Fr 09.01.09 18:50 
Nee sorry, keine Ahnung wie du das meinst, liegt ja nur an der Zeile
vom Prinzip her hätt ich gedacht man schreibt es so:

drucker.Canvas.stretchdraw(0,0, Breite des Bildes, Höhe des Bildes);

irgendwie so...

glaub das im FormCreat kann ich weglassen.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Fr 09.01.09 20:28 
Das stimmt ja prinzipiell auch, du musst als ersten Parameter das Rechteck angeben, in das das Bild gezeichnet werden soll und als zweiten Parameter welches Bild.

Wie du das Zielrechteck bekommst, siehst du ja in meinem Beispiel. Und das Bild ist dann Image.Picture.Bitmap ;-).
Tony-S Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 184
Erhaltene Danke: 6

Windows 7, XP, Ubtuntu
Delphi 7, Visual Basic.net
BeitragVerfasst: Fr 09.01.09 22:52 
Ok es klappt jetzt, ich habs aber einfacher gmeacht, mich hat eigentlich nur dieses bmp im formcreate verwirrt und das erstellen des rects das brauch man wie es scheint nich wenn man es mit in die zeile schreibt.

procedure TForm1.BTN_DruckenClick(Sender: TObject);
begin
drucker.begindoc;

drucker.Canvas.Draw(0,0,dpl.picture.bitmap);
drucker.canvas.stretchdraw (rect(0,0,drucker.pagewidth,drucker.pageheight),dpl.picture.bitmap);

drucker.enddoc;

so spart man sich den anderen Quatsch^^ .., dann hab ich aber bemerkt das dass ja mit dem Seitenverhältniss nich hinkommen kann alsooo
muss n faktor rann..

sieht dann so aus

procedure TForm1.BTN_DruckenClick(Sender: TObject);
var faktor:real;
var sx,sy:word;

begin
drucker.begindoc;
faktor := 1 + (drucker.pagewidth / dpl.picture.bitmap.width);

sx := round(dpl.picture.bitmap.width * faktor);
sy := round(dpl.picture.bitmap.height * faktor);

drucker.Canvas.Draw(0,0,dpl.picture.bitmap);

drucker.canvas.stretchdraw (rect(0,0,sx,sy),dpl.picture.bitmap);
drucker.enddoc;

Mal gucken wie das jetzt mit der Vorschau funzt..

Aber erstmal ein großes Danke an die, die mir geholfen haben!
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Fr 09.01.09 22:57 
Das Draw kannst du dir dann sparen. ;-)

Und weshalb das mit der Hintergrundbitmap und der TPaintBox keine schlechte Idee ist wirst du merken, wenn du das Programm erweiterst. ;-)
Tony-S Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 184
Erhaltene Danke: 6

Windows 7, XP, Ubtuntu
Delphi 7, Visual Basic.net
BeitragVerfasst: Fr 09.01.09 22:59 
Ich denke mal wegen dem scrollen oder?, ginge aber auch ne scrollbox oder wie das ding heißt.

Achja und das Hint klappt bei mir nich ;-) d.h ich seh mit nem "mouseover" nic hwas was is :D
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Fr 09.01.09 23:06 
user profile iconTony-S hat folgendes geschrieben Zum zitierten Posting springen:
Ich denke mal wegen dem scrollen oder?, ginge aber auch ne scrollbox oder wie das ding heißt.
Nein, ich meine z.B. wenn du ein Rechteck mit der Maus aufziehen willst usw., das geht zwar auch mit nem TImage (ich hatte das auch mal damit gemacht), aber mit TPaintBox wäre es einfacher gewesen. ;-)
Tony-S Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 184
Erhaltene Danke: 6

Windows 7, XP, Ubtuntu
Delphi 7, Visual Basic.net
BeitragVerfasst: Fr 09.01.09 23:10 
Ich kann mir auch vorstellen warum, wenn man das einfach so macht, hat man keine Echtzeitvorschau, vllt ginge das mit nem zweiten Image.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Fr 09.01.09 23:21 
Naja, das funktioniert auch mit einem. Aber nicht so gut. ;-)
Man kann z.B. die Farben umkehren und wieder zurück umkehren.
Tony-S Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 184
Erhaltene Danke: 6

Windows 7, XP, Ubtuntu
Delphi 7, Visual Basic.net
BeitragVerfasst: Fr 09.01.09 23:45 
Ok ich denk mal ich nehm mir jetzt die Vorschau zur Brust :D.

Naja man brauch halt doch noch immer mal Hilfe nach nem 3/4 Jahr "Schul-Delphi" ;-)