Mattias Gaertner wrote:
On Wed, 15 Mar 2006 08:36:30 +0100
"Patrick Chevalley" <[EMAIL PROTECTED]> wrote:
Hi,
Even on my computer, that has a slightly bigger standard font on
Windows, most forms from the IDE look bad.
I also remark this problem with my application, only with Windows big
font, all the testing I do with Gtk at different screen resolution do not
show this problem.
I solve by calling this function after form.create :
scale := Screen.PixelsPerInch / myform.PixelsPerInch
*{$ifdef win32}*ScaleForm(myform,scale);*{$endif}*
*procedure* ScaleForm(form: TForm; scale: single);*
var* i: integer;*
begin*
*if* abs(1-scale)>0.1 *then* // *do* *not* scale *for* 10%
*with* form *do* *begin*
width := round( width * scale );
height := round( height * scale );
*for* i := 0 *to* ComponentCount-1 *do* *begin*
*if* ( Components[i] is TControl ) *then* *with* (Components[i]
as TControl) *do* *begin*
width := round( width * scale );
height := round( height * scale );
top := round( top * scale );
left := round( left * scale );
*end*;
*end*;
*end*;
*end*;
Maybe this can be implemented in TCustomForm ? but this is outside of my
competence.
If I remember Delphi as a TForm.Scaled property that do something like
that.
The scale only fixes resized fonts, but not other fonts, themes and
translations.
As Darius pointed out: we should improve the dialogs to use autosizing.
Mattias
Solution is to add sizers controls like in wxWidgets. Sizers are like
non-visual panels which can grow or shrink on runtime in one or both
directions with children aligned/scaled inside them.
I don't like them but I must confess that I don't see any better solution.
Please check wxWidgets documentation for details.
Regards
Boguslaw Brandys
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives