Solved

How to convert a text into a picture?

Posted on 1998-09-10
11
277 Views
Last Modified: 2010-04-06
I tried to convert a text into a picture like this:
image1.assign(richedit1.text). That didn't work.How will it work?
thanks.
Duke
0
Comment
Question by:duke_n
  • 5
  • 2
  • 2
  • +1
11 Comments
 
LVL 4

Expert Comment

by:d003303
ID: 1339271
With TRichEdit it is quite difficult. Look at the PrintPreview control on this page:
http://www.radix.net/~bziegler/Delphi/ 
it has full source included and has a function that renders the contents of a TRichEdit onto a canvas. Just provide a bitmap canvas instead, that'S it.

Slash/d003303
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1339272
Hello Duke. Is this what you need???

I've used the Button's OnClick() event...
-----------
procedure TForm1.Button1Click(Sender: TObject);
var
  DC : hDC;
begin
  DC := GetDC(RichEdit1.Handle);
  BitBlt(Image1.Canvas.Handle,0,0,Width, Height, DC,0,0, SRCCOPY);
  ReleaseDC(RichEdit1.Handle, DC);
end;
----------
Regards,
Viktor Ivanov
0
 
LVL 1

Author Comment

by:duke_n
ID: 1339273
sOME code, please
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 1

Author Comment

by:duke_n
ID: 1339274
//To viktornet
thanks! this is really good'n'simple solution , but it works only one time-the first time I press the button. If I make changes to the richedit and press the button again, it does not update the image
thanks
Roma
0
 
LVL 4

Expert Comment

by:d003303
ID: 1339275
...have you taken a look at the sources I pointed you to ? If you have questions regarding these sources -> ask !

Slash/d003303
0
 

Expert Comment

by:ILPowerSoft
ID: 1339276
Te SHto CAzol EA fKLOchel TboE praGRAMo KEyblbl YA neMOGO
veCLOshet TE soKA POsmoTRE KAk yaE PEshO E sHTO Te HOcheS
A teXT comPAler
0
 
LVL 1

Author Comment

by:duke_n
ID: 1339277
//tO pOWERSOFT
write me an e-mail in normal english!!!
hahahahaha
you'll need a super-spellchecker
0
 

Expert Comment

by:ILPowerSoft
ID: 1339278
I WRit YOU in ruSSAN
I doNT no HOw to SPell yor EMAIL
I RUN Your ProgrAM KEYprevE and I cant CLOS iT
Russon
pusoL NAho kazoL pazvONEs e uzaNEH paCHEMO
0
 
LVL 1

Author Comment

by:duke_n
ID: 1339279
//To d003303
I just don't know what to do with this TPreviewPrinter component.
First I assin to it richedit1.text. Then I should assign the contents of Previewprinter1 to Image1. How? What is the property that represents contents of TpreviewPrinter(like Picture.bitmap in Timage case)?

0
 
LVL 1

Author Comment

by:duke_n
ID: 1339280
//To d003303
I just don't know what to do with this TPreviewPrinter component.
First I assign to it richedit1.text. Then I should assign the contents of Previewprinter1 to Image1. How? What is the property that represents contents of TpreviewPrinter(like Picture.bitmap in Timage case)?

0
 
LVL 10

Accepted Solution

by:
viktornet earned 10 total points
ID: 1339281
Ok, then ..here is the new code that updates it every time you press the button
---------
procedure TForm1.Button1Click(Sender: TObject);
var
       DC : hDC;
     begin
       Image1.Canvas.Brush.Color := Color;
       Image1.Canvas.FillRect(Image1.Canvas.ClipRect);
       DC := GetDC(RichEdit1.Handle);
       BitBlt(Image1.Canvas.Handle,0,0,Width, Height, DC,0,0, SRCCOPY);
       ReleaseDC(RichEdit1.Handle, DC);
     end;
-------------
Regards,
Viktor Ivanov
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question