Author: Tomas Rutkauskas How to copy text from a TRichEdit to the canvas of a TImage Answer: 1 uses 2 Richedit; 3 4 var 5 imagecanvas: TCanvas; 6 fmt: TFormatRange; 7 begin 8 imagecanvas := image1.canvas; 9 with fmt do 10 begin 11 hdc := imagecanvas.handle; 12 hdcTarget := hdc; 13 rc := Rect(0, 0, imagecanvas.cliprect.right * 1440 div pixelsperinch, 14 imagecanvas.cliprect.bottom * 1440 div pixelsperinch); 15 rcPage := rc; 16 chrg.cpMin := 0; 17 chrg.cpMax := richedit1.GetTextLen; 18 end; 19 { SetBkMode( imagecanvas.Handle, TRANSPARENT ); } 20 richedit1.perform(EM_FORMATRANGE, 1, integer(@fmt)); 21 richedit1.perform(EM_FORMATRANGE, 0, 0); 22 image1.refresh; 23 end;