Solved

How to convert a text into a picture?

Posted on 1998-09-10
11
273 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
Comment Utility
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
Comment Utility
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
Comment Utility
sOME code, please
0
 
LVL 1

Author Comment

by:duke_n
Comment Utility
//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
Comment Utility
...have you taken a look at the sources I pointed you to ? If you have questions regarding these sources -> ask !

Slash/d003303
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

Expert Comment

by:ILPowerSoft
Comment Utility
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
Comment Utility
//tO pOWERSOFT
write me an e-mail in normal english!!!
hahahahaha
you'll need a super-spellchecker
0
 

Expert Comment

by:ILPowerSoft
Comment Utility
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
Comment Utility
//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
Comment Utility
//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
Comment Utility
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now