Autor Beitrag
Kawa
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 45
Erhaltene Danke: 1



BeitragVerfasst: So 04.11.07 21:04 
Hallo!

warum lässt sich Label nicht mit einem (Image-jpg)bild drucken,
wenn ich auf bild mit hilfe edit auf Label was rein schreibe?

Wo Label fest aufs Bild angebracht ist !
also nicht mit zb.( Printer.Canvas.TextOut(20,50,Form1.label1.Caption); )

Danke!



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:
   //----- Hiermit werden Grafiken millimetergenau ausgedruckt
procedure  Grafik_mm_Druck(Grafik:TGraphic;Mass:double;MassIstErwarteteBreite:boolean;
links,oben:integer);
var
h:THandle;
waagerechtePixel,senkrechtePixel:integer;
BildHoehe,BildBreite:double;
r:TRect;

function rechnen(a:integer;w:double):integer;
begin
result:=round((a * w) / 25.4);
end;
begin
h:=printer.handle;
if MassIstErwarteteBreite then begin
BildHoehe:=Mass * (grafik.height / grafik.width);
BildBreite:=Mass;
end else begin
BildBreite:=Mass * (grafik.width / grafik.height);
BildHoehe:=Mass;
end;
waagerechtePixel:=getdevicecaps(h,logpixelsx);
senkrechtePixel:=getdevicecaps(h,logpixelsy);
links:=rechnen(waagerechtePixel,links)-getdevicecaps(h,physicaloffsetx);
oben:=rechnen(senkrechtePixel,oben)-getdevicecaps(h,physicaloffsety);
r:=rect(links,oben,links+rechnen(waagerechtePixel,BildBreite),
oben+rechnen(senkrechtePixel,BildHoehe));
with printer do begin
begindoc;
canvas.stretchdraw(r,Grafik);

enddoc;
end;
end;  

  procedure TForm1.Button1Click(Sender: TObject);
  begin
  Grafik_mm_Druck(Image1.picture.graphic,143,True,3,15);
  end;
  
procedure TForm1.Edit1Change(Sender: TObject);
begin
  label1.caption:=(form1.Edit1.Text);
end;


Moderiert von user profile iconChristian S.: Code- durch Delphi-Tags ersetzt
Yogu
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2598
Erhaltene Danke: 156

Ubuntu 13.04, Win 7
C# (VS 2013)
BeitragVerfasst: Di 06.11.07 18:44 
Wo druckts du denn dein Label auf das Bild? Ich sehe keine Anweisung, die das macht. Und benutz doch Canvas.TextOut, um Text in Grafiken einzufügen.
Kawa Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 45
Erhaltene Danke: 1



BeitragVerfasst: Di 06.11.07 21:12 
Hallo,
Das Label wird im Entwicklermodus angebracht auf Image-Komponente,
Links oben.(wenn ich das Bild drucke, soll ja dienen als Datum)

zur Laufzeit schreibe ich ein Text über edit auf Label, wo Text auf den Bild zu sehen ist.
Wenn ich jetzt Drucke sehe ich nichts von Text nur das Bild.
Ich muss aber extra noch etwas Code reinschreiben damit ich Bild mit Text zusammen Drucken kann.
Daher soll ich Label nicht mit extra Kordinaten im Entwicklermodus eingeben zu müssen.
so wie:
 Printer.Canvas.TextOut(20,50,Form1.label1.Caption);
Yogu
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2598
Erhaltene Danke: 156

Ubuntu 13.04, Win 7
C# (VS 2013)
BeitragVerfasst: Di 06.11.07 21:22 
Wenn ich das richtig verstanden habe, willst du die Koordinaten im Quelltext nicht noch einmal eingeben. Dann mach es doch einfach so:
ausblenden Delphi-Quelltext
1:
Printer.Canvas.TextOut(Form1.label1.Left,Form1.label1.Top,Form1.label1.Caption);					
Kawa Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 45
Erhaltene Danke: 1



BeitragVerfasst: Di 06.11.07 21:47 
...genau so!

Danke Yogu,
ich werde deine Code Propieren.