>I would like to find a simple way of changing how forms appear, depending on the way the user has set their windows font size, without having to create 2 or 3 versions of every form.
>To dynamically change the classes on the form, I would need to change the height, width and font size of every class (labels, textboxes, etc) to keep everything consistent. Why can you not just change the form's font, so that it alters the form (the way changing the windows resolution does)?
>Any help would be greatly appreciated.
>joelplat@yahoo.com
Hi Joel,
I just made a quick test: I create a form with TextBox and Label and put this code into Init of the TextBox and Label:
this.FontName="Tahoma"
this.FontSize=13
this.FontBold=.t.
This works just fine.
So, in your classes Init you have to put something like that:
local lcFont, lnFontSize, lcStyle
lcFont="Arial"
lnFontSize=9
lcStyle="" && Normal
=RetrieveFontAttribute(@lcFont,@lnFontSize,@lcStyle)
with this
.FontName=lcFont
.FontSize=lnFontSize
** Set FontStyle attributes
*!* B Bold
*!* I Italic
*!* N Normal
*!* O Outline
*!* Q Opaque
*!* S Shadow
*!* – Strikeout
*!* T Transparent
*!* U Underline
endwith
The next question is RetrieveFontAttributes. It could be a common UDF or BaseForm method, for example. You have to find a way of retrieving font attributes. Take a look into FAQ section Getting Title Bar Attributes, it may help you.
If it's not broken, fix it until it is.
My Blog