Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to convert a text into a picture?

Posted on 1998-09-10
11
Medium Priority
?
282 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
Industry Leaders: 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 40 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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

876 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