Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Dynamic TFrame and large font

251 views
Skip to first unread message

Ole Fromberg

unread,
May 5, 2003, 3:37:08 AM5/5/03
to
Hi,

Has anyone experienced problems with large fonts when placing a frame
on a form at runtime?
If I just place the frame on my form at design time, there are no
problems. Every control in the frame stretches nicely when changing to
large fonts.

I create my frame at runtime like this:

procedure TForm1.FormCreate(Sender: TObject);
begin
UserGroupFrame := TFrameUserGroup.Create(self);
UserGroupFrame.Parent := Panel2;
UserGroupFrame.Align := alClient;
UserGroupFrame.AutoScroll := False;
end;

AutoScroll on the form is set to false;

Any help is appreciated!

Ole Fromberg


Peter Below (TeamB)

unread,
May 5, 2003, 1:33:34 PM5/5/03
to
In article <3eb6...@newsgroups.borland.com>, Ole Fromberg wrote:
> Has anyone experienced problems with large fonts when placing a frame
> on a form at runtime?

I do that all the time, no problems.

> If I just place the frame on my form at design time, there are no
> problems. Every control in the frame stretches nicely when changing to
> large fonts.
>
> I create my frame at runtime like this:
>
> procedure TForm1.FormCreate(Sender: TObject);
> begin
> UserGroupFrame := TFrameUserGroup.Create(self);
> UserGroupFrame.Parent := Panel2;
> UserGroupFrame.Align := alClient;
> UserGroupFrame.AutoScroll := False;
> end;
>
> AutoScroll on the form is set to false;

And the problem is?


--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be

Ole Fromberg

unread,
May 5, 2003, 5:24:22 PM5/5/03
to
My dynamic TFrame acts just as a normal form where the scaled property is
set to false. The controls overlap each other when switching from small to
large font. I have tried to use a dynamic TForm (scaled := true) instead of
TFrame and then the problem disappears. I can use that solution, but I still
wonder why. I use Delphi 6 with an update pack 2. What difference does it
make when I create a TFrame runtime instead of design-time. Could there be a
property that are to be set? TForm has the scaled property, why does the
TFrame not? This property seems to be very important in large font issues.

Ole

"Peter Below (TeamB)" <10011...@compuXXserve.com> wrote in message
news:VA.00009dc...@antispam.compuserve.com...

Peter Below (TeamB)

unread,
May 6, 2003, 12:28:52 PM5/6/03
to
In article <3eb6d655$1...@newsgroups.borland.com>, Ole Fromberg wrote:
> My dynamic TFrame acts just as a normal form where the scaled property is
> set to false. The controls overlap each other when switching from small to
> large font. I have tried to use a dynamic TForm (scaled := true) instead of
> TFrame and then the problem disappears. I can use that solution, but I still
> wonder why. I use Delphi 6 with an update pack 2. What difference does it
> make when I create a TFrame runtime instead of design-time.

If you create it at design-time then it is scaled with the form when the form
scales itself. If you create it at run-time that does not happen, of course,
since only *forms* are scaled automatically, if requested. You can try to use
the ScaleBy method the frame inherits from TWinControl to do the scaling
manually, after the frame has been created in code.

I design in large font mode only (my default since i'm quite myopic), use
TrueType fonts only, and set Scaled to false for all forms. No problems this
way if the app is run on small font systems.

Ole Fromberg

unread,
May 6, 2003, 5:33:10 PM5/6/03
to
This was very interesting. I've tried to experiment with scaleby procedure
for the dynamic TFrame. By hardcoding the original width for the form in the
second parameter and the formvariabel width in the first parameter and
setting the forms scaled property to true, did the trick. When switching to
large font, the form will scale and the width will therefore change. The
ratio between the two parameters will scale the frame correctly.

procedure TForm1.FormCreate(Sender: TObject);
begin
UserGroupFrame := TFrameUserGroup.Create(self);

UserGroupFrame.Parent := panel2;
UserGroupFrame.Align := alClient;
UserGroupFrame.ScaleBy(width,549); // 549 is the forms width at design-time
end;

Thanks a lot!

Kind regards
Ole Fromberg

"Peter Below (TeamB)" <10011...@compuXXserve.com> wrote in message

news:VA.00009dd...@antispam.compuserve.com...

0 new messages