Solved

Text to Bmp

Posted on 2001-08-19
6
302 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
  • 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 3

Accepted Solution

by:
Slavak earned 10 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
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…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

747 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

17 Experts available now in Live!

Get 1:1 Help Now