Autor Beitrag
Jakob_Ullmann
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1747
Erhaltene Danke: 15

Win 7, *Ubuntu GNU/Linux*
*Anjuta* (C, C++, Python), Geany (Vala), Lazarus (Pascal), Eclipse (Java)
BeitragVerfasst: So 31.08.08 13:31 
Hallo,

anscheinend kann man ja mit dem TMozillaBrowser auch eine Grafikausgabe machen. Cool wäre natürlich eine Ausgabe als (Enhanced) MetaFile, aber ich wollte es erst einmal mit einer Bitmap probieren. Ich dachte eventuell, PaintTo wäre es, aber ich sehe nur ein weißes Bild, mit

ausblenden Delphi-Quelltext
1:
MozillaBrowser1.PaintTo(Image1.Canvas.Handle, 1, 1);					


oder mit

ausblenden Delphi-Quelltext
1:
MozillaBrowser1.PaintTo(Image1.Canvas, 1, 1);					


Wie muss ich das machen? Bei der Google-Suche gab's in einem anderen Forum so nen Thread, allerdings unbeantwortet.

PS: Ja, eine Seite ist natürlich geladen (lokal).
Tilman
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1405
Erhaltene Danke: 51

Win 7, Android
Turbo Delphi, Eclipse
BeitragVerfasst: So 31.08.08 22:18 
Habe mal nachgeschaut, paintto ist eine geerbte Methode von TWinControl, also nix von TMozillaBrowser eingeführtes. Wie es funzt kannst du in der Delphi-Hilfe zu TWinControl nachlesen. Ich fürchte aber, wenn TMozillaBrowser da nix selbst unterstützend mithilft wird das so nix.

Es ist aber möglich mit der Windows-Api das Steuerelement zumindest auf einen anderen Gerätekontext (ein Bitmap, eine Paintbox o.ä.) zu zeichnen, allerdings bekommst du so nur den Sichtbaren Teil, und kannst z.B. nicht eine Komplette Seite speichern (es sei denn sie wird komplett angezeigt).

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure TForm1.Button2Click(Sender: TObject);
  var
    canv: Tcanvas;
begin
  canv := TCanvas.Create;  // TCanvas erzeugen
  canv.Handle := getWindowDC(moz.Handle);  // moz ist mein TMozillaBrowser
  pb.Canvas.CopyRect(canv.ClipRect,canv,canv.ClipRect);  // pb ist eine Paintbox
  canv.Free;
end;

_________________
Bringe einen Menschen zum grübeln, dann kannst du heimlich seinen Reis essen.
(Koreanisches Sprichwort)
Jakob_Ullmann Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1747
Erhaltene Danke: 15

Win 7, *Ubuntu GNU/Linux*
*Anjuta* (C, C++, Python), Geany (Vala), Lazarus (Pascal), Eclipse (Java)
BeitragVerfasst: Mo 01.09.08 17:27 
OK, danke! :D Die Seite wird meistens komplett angezeigt, es handelt sich um reines MathML mit jeweils nur einer Formel. :wink: