![]() |
Text auf image zeichnen ?
Liste der Anhänge anzeigen (Anzahl: 1)
Hallo
ein Code von CodeGear zeichnet den Text von Richedit auf Image ![]() Das Problem: Die Formatierung in Richedit und auf Image ist nicht die Selbe das Bild im Anhang zeigt das Ergebnis Woran kann das liegen :gruebel: |
Re: Text auf image zeichnen ?
Hallo, eine andere Möglichkeit wäre mittels EM_FORMATRANGE.
Beispiel von P. Below:
Delphi-Quellcode:
uses
RichEdit; procedure RichEditToCanvas(RichEdit: TRichEdit; Canvas: TCanvas; PixelsPerInch: Integer); var ImageCanvas: TCanvas; fmt: TFormatRange; begin ImageCanvas := Canvas; with fmt do begin hdc := ImageCanvas.Handle; hdcTarget := hdc; // rect needs to be specified in twips (1/1440 inch) as unit rc := Rect(0, 0, ImageCanvas.ClipRect.Right * 1440 div PixelsPerInch, ImageCanvas.ClipRect.Bottom * 1440 div PixelsPerInch); rcPage := rc; chrg.cpMin := 0; chrg.cpMax := RichEdit.GetTextLen; end; SetBkMode(ImageCanvas.Handle, TRANSPARENT); RichEdit.Perform(EM_FORMATRANGE, 1, Integer(@fmt)); // next call frees some cached data RichEdit.Perform(EM_FORMATRANGE, 0, 0); end; procedure TForm1.Button1Click(Sender: TObject); begin RichEditToCanvas(RichEdit1, Image1.Canvas, Self.PixelsPerInch); Image1.Refresh; end; |
Re: Text auf image zeichnen ?
:thumb: ausgezeichnet ! Danke sehr
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 11:42 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