From: "Harm" Subject: Re: Memo to bitmap Date: 29 Mar 2000 00:00:00 GMT Message-ID: <8bt981$7a19@bornews.borland.com> References: <38df17eb@dnews> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 Organization: Another Netscape Collabra Server User X-MSMail-Priority: Normal Newsgroups: borland.public.delphi.graphics An easy method is use the DrawText API call. You should call it twice; first time measures the text, second time actually draws it. In this example, a 10-pixel margin is added. Keep in mind that this example does not take into account all the TMemo settings - like word wrap. But, if you look at the help for DrawText, you'll find lots of parameters to control the output (check DT_WORDBREAK). (note - error checking omitted for clarity of code). This example uses a TMemo, a TImage, and a TButton: procedure TForm1.Button1Click(Sender: TObject); var bmp : TBitmap; // Draw Memo text on this TextRect : TRect; // For measuring text lcr : integer; // Left Center Right begin bmp := TBitmap.Create; bmp.Canvas.Font := Memo1.Font; lcr := 0; // Avoid compiler warnings if Memo1.Alignment = taLeftJustify then lcr := DT_LEFT; if Memo1.Alignment = taCenter then lcr := DT_CENTER; if Memo1.Alignment = taRightJustify then lcr := DT_RIGHT; TextRect.Left := 0; TextRect.Top := 0; // First time, add DT_CALCRECT to determine rectangle size DrawText(bmp.Canvas.Handle,PChar(Memo1.Text), // Measure rect length(Memo1.Text),TextRect, DT_CALCRECT or DT_NOPREFIX or lcr); // Make our bmp a bit larger, to provide a margin bmp.Width := TextRect.Right - TextRect.Left + 20; bmp.Height := TextRect.Bottom - TextRect.Top + 20; bmp.Canvas.Brush.Color := clAqua; bmp.Canvas.Fillrect(RECT(0,0,bmp.Width,bmp.Height)); // Now move our Text Rectangle over and down a bit OffsetRect(TextRect,10,10); DrawText(bmp.Canvas.Handle,PChar(Memo1.Text), // Draw Text length(Memo1.Text),TextRect, DT_NOPREFIX or lcr); Image1.Picture.Assign(bmp); bmp.Free; Image1.Refresh; end; "Tassos Voulgaris" wrote in message news:38df17eb@dnews... > How can I convert all the lines of a memo to a single bitmap ? > Thanks in advanced :)