Thanks meikl , sorry about the low points , had exhausted all mine
Main Topics
Browse All TopicsI am required to display a text centred in the middle on my form .
It is a plain form with nothing else except this text.
This text is random , sometimes it is 10 characters long and maximum 200 chars long
The issue here is to display the text with as big a fontsize as possible within the area available.
The form size is height - 400 and width - 700.
Text should be wrapped around if it exceeds the width of the form
How can I do this , I can use any component like label , memo etc but I am not getting quite how to resize the font size
I am sorry I dont have much points to offer
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: kretzschmarPosted on 2008-02-13 at 00:29:55ID: 20882533
puh, 20 pts is a bit rare
: TObject); ticalCente r,tfNoClip ]; rticalCent er,tfNoCli p]; Limit); ); Limit);
nevertheless a small sample using the forms-canvas directly
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender
const
widthLimit = 700;
heightLimit = 400;
var
tf : TTextFormat;
tfCalc : TTextFormat;
r : TRect;
s : String;
begin
tfCalc := [tfCalcRect, tfWordBreak,tfCenter,tfVer
tf := [tfWordBreak,tfCenter,tfVe
r := Rect(0,0,widthLimit,height
s := edit1.Text;
canvas.Font.Size := 0;
repeat
canvas.Font.Size := canvas.Font.Size + 1;
canvas.TextRect(r,s,tfCalc
until ((r.Right > widthLimit) or (r.Bottom > heightLimit));
//use last Fitted
canvas.Font.Size := canvas.Font.Size - 1;
r := Rect(0,0,widthLimit,height
canvas.TextRect(r,s,tf);
end;
end.
meikl ;-)