[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Text to Bmp

Posted on 2001-08-19
6
Medium Priority
?
323 Views
Last Modified: 2010-04-06
If i use a text entry box how can i save the text as a .bmp




0
Comment
Question by:neopolis
[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
  • 2
  • 2
  • 2
6 Comments
 
LVL 3

Expert Comment

by:Slavak
ID: 6403561
Try it,

 Bmp := TBitmap.Create;
 Try
  With Bmp Do Begin
   Canvas.Font.Assign(Edit1.Font);
   Width  := Canvas.TextWidth(Edit1.Text);
   Height := Canvas.TextHeight(Edit1.Text);
   Canvas.TextOut(0, 0, Edit1.Text);
   SaveToFile(FileName);
  End;
 finally
  Bmp.Free;
 end;
0
 

Author Comment

by:neopolis
ID: 6404238
Looks good
can you email a demo made i am new at delphi
thanks
0
 
LVL 5

Expert Comment

by:Gwena
ID: 6404609
Hi neopolis :-)

 Here is slavak's code installed in a buttonclick procedure
maybe this will help you... just start delphi and add a button and an edit box to your form... then double click the button to make an event handler... then just replace that button code with this... it will save the text that is in the edit box to a file called TxtBmp.bmp ..it saves it to the floppy drive but you can change it to any drive :-)



procedure TForm1.Button1Click(Sender: TObject);
var MyBmp: tbitmap;
begin
  MyBmp := TBitmap.Create;
  Try
  With MyBmp Do
    Begin
      Canvas.Font.Assign(Edit1.Font);
      Width  := Canvas.TextWidth(Edit1.Text);
      Height := Canvas.TextHeight(Edit1.Text);
      Canvas.TextOut(0, 0, Edit1.Text);
      SaveToFile('A:\TxtBmp.bmp');
    End;
  finally
  MyBmp.Free;
  end;
end;

0
Technology Partners: 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 3

Accepted Solution

by:
Slavak earned 40 total points
ID: 6405289
Thanks, Gwena :)
0
 
LVL 5

Expert Comment

by:Gwena
ID: 6405314
:-)
0
 

Author Comment

by:neopolis
ID: 6406591
Thank you Slavak and Gwena
your explanation was easy for me to follow
i am new very much appreciated again Thank You..
0

Featured Post

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!

Question has a verified solution.

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

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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

656 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