Board index » delphi » TForm.caption font - Who knows how to access?

TForm.caption font - Who knows how to access?

I need to calculate the width of text of the caption of a form. I have
a function to do this, all I need to give it is the text and the font,
and it give the pixel width. That way I can calculate whether text
will fit in a certain space.

Now the problem I have is that I don't know what font the TForm
caption uses. There seems to be no way in Delphi 16-bit in which the
user or I the progammer can change the font. I think the user may be
able to change the caption font globally by customising the Windows
setup itself.

Should I just assume that any Win 3.1 installation uses System 10
Normal, and any Win 95 installation uses what? This approach does not
feel comfortable to me. I am looking for something more fool-proof.

Email appreciated. I reply to every email.
Matthew

 

Re:TForm.caption font - Who knows how to access?


Quote
Matthew wrote:

> I need to calculate the width of text of the caption of a form. I have
> a function to do this, all I need to give it is the text and the font,
> and it give the pixel width. That way I can calculate whether text
> will fit in a certain space.

> Now the problem I have is that I don't know what font the TForm
> caption uses. There seems to be no way in Delphi 16-bit in which the
> user or I the progammer can change the font. I think the user may be
> able to change the caption font globally by customising the Windows
> setup itself.

> Should I just assume that any Win 3.1 installation uses System 10
> Normal, and any Win 95 installation uses what? This approach does not
> feel comfortable to me. I am looking for something more fool-proof.

The caption bar uses (at least in Win95, been so long since I had
3.x...) a font designated by the user. The user can say they want all
caption bars to bin in, say, Courier New, size 100. I know there is a
way to change the Caption's font and size under Win95, but I'm not sure
how. I've seen components (Delphi 2) that can change the caption bar,
but they were DCU only, so I have no idea how it works. I'm pretty sure
you can't change the caption bar font under Windows 3.x.

--
+--------------------------------+
|        The Messiah             |
+--------------------------------+
|  Ou' sont les neiges d' antan  |
|         Villon                 |
+________________________________+
|    There is a man...           |
|   playing a violin...          |
|   and the strings...           |
| are the nerves in his own arm. |
| A twisted soul- the mortar...  |
|  despair- the bricks...        |
| to build a temple of sadness.  |
|  The Crow, J. O'Barr           |
+--------------------------------+

Other Threads