![]() |
Stringgrid und bmp auf eine seite drucken
Hallo allerseits,
also ich hab folgendes Problem. Ich habe eine Stringgrid welche ich erfolgreich über meinen Drucker ausgeben kann. Nun möchte ich allerdings gerne vor der Grid ein bmp-File ausdrucken, also auf die gleiche Seite. Kann mir wer sagen wie ich das bewerkstellige - ein simples printer.canvas.draw(x,y,bmp) geht irgendwie nicht. Ich poste mal die Druckmethode... (zugegeben nicht von mir *g* )
Delphi-Quellcode:
procedure TAlarmform.termin_GridDruck(grd: TStringGrid; links, oben, vSpalte, bSpalte, vZeile, bZeile: integer; scal: double; farbig: boolean); var Bmp: TBitmap; x, y, li, ob, re, un, waag, senk, a: integer; fix, grund, schrift: TColor; r: Trect; function rech(i, j: integer): integer; begin result := round(((i * j) / 72) * scal); end; begin Bmp := TBitmap.Create; bmp.LoadFromFile(pdaten.prog_dir + '\data\pics\tman.bmp'); if vZeile < 0 then vZeile := 0; if vSpalte < 0 then vSpalte := 0; if (bZeile >= grd.rowcount) or (bZeile < 0) then bZeile := grd.rowcount - 1; if (bSpalte >= grd.colcount) or (bSpalte < 0) then bSpalte := grd.colcount - 1; if vZeile > bZeile then begin a := vZeile; vZeile := bZeile; bZeile := a; end; if vSpalte > bSpalte then begin a := vSpalte; vSpalte := bSpalte; bSpalte := a; end; if (scal > 0) and (vZeile < grd.rowcount) and (vSpalte < grd.colcount) then begin if farbig then begin fix := grd.fixedcolor; grund := grd.color; schrift := grd.font.color; end else begin fix := clsilver; grund := clwhite; schrift := clblack; end; waag := getdevicecaps(printer.handle, logpixelsx); senk := getdevicecaps(printer.handle, logpixelsy); links := rech(links, waag); oben := rech(oben, senk); li := getdevicecaps(printer.handle, physicaloffsetx) + 1 + links; a := rech(3, waag); with printer do begin title := 'Grid-Druck'; BeginDoc; Canvas.Draw(100, 50, Bmp); if grd.gridlinewidth > 0 then begin canvas.pen.color := $333333; canvas.pen.width := 1; canvas.pen.style := pssolid end else canvas.pen.style := psclear; canvas.font := grd.font; canvas.font.color := schrift; canvas.font.size := round((grd.font.size / 0.72) * scal); for x := vSpalte to bSpalte do begin ob := getdevicecaps(printer.handle, physicaloffsety) + 1 + oben; re := li + rech(grd.ColWidths[x] + 1, waag); for y := vZeile to bZeile do begin un := ob + rech(grd.RowHeights[y] + 1, senk); if (x < grd.fixedcols) or (y < grd.fixedrows) then canvas.brush.color := fix else canvas.brush.color := grund; canvas.rectangle(li, ob, re + 2, un + 2); r := rect(li + a, ob + 1, re - a, un - 2); drawtext(canvas.handle, pchar(grd.Cells[x, y]), length(grd.Cells[x, y]), r, DT_SINGLELINE or DT_VCENTER); ob := un; end; li := re; end; enddoc; end; end; end; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 20:50 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