Solved

How to convert a text into a picture?

Posted on 1998-09-10
11
279 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
find a node in VST 2 92
Run video youtube webbrowse 10 86
How to debug For loops? 3 74
How do I add a client SSL certificate to a SOAP client in Rad Studio Delphi? 2 221
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

738 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