Solved

How to convert a text into a picture?

Posted on 1998-09-10
11
278 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi component that can load a DLL in design time? 8 92
code issue 8 183
error 1.1 400 Bad request idhttp delphi 18 202
update joined tables 2 62
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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

756 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