neopolis
asked on
Text to Bmp
If i use a text entry box how can i save the text as a .bmp
ASKER
Looks good
can you email a demo made i am new at delphi
thanks
can you email a demo made i am new at delphi
thanks
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.F ont);
Width := Canvas.TextWidth(Edit1.Tex t);
Height := Canvas.TextHeight(Edit1.Te xt);
Canvas.TextOut(0, 0, Edit1.Text);
SaveToFile('A:\TxtBmp.bmp' );
End;
finally
MyBmp.Free;
end;
end;
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
var MyBmp: tbitmap;
begin
MyBmp := TBitmap.Create;
Try
With MyBmp Do
Begin
Canvas.Font.Assign(Edit1.F
Width := Canvas.TextWidth(Edit1.Tex
Height := Canvas.TextHeight(Edit1.Te
Canvas.TextOut(0, 0, Edit1.Text);
SaveToFile('A:\TxtBmp.bmp'
End;
finally
MyBmp.Free;
end;
end;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
:-)
ASKER
Thank you Slavak and Gwena
your explanation was easy for me to follow
i am new very much appreciated again Thank You..
your explanation was easy for me to follow
i am new very much appreciated again Thank You..
Bmp := TBitmap.Create;
Try
With Bmp Do Begin
Canvas.Font.Assign(Edit1.F
Width := Canvas.TextWidth(Edit1.Tex
Height := Canvas.TextHeight(Edit1.Te
Canvas.TextOut(0, 0, Edit1.Text);
SaveToFile(FileName);
End;
finally
Bmp.Free;
end;