📄 faq25.htm
字号:
<HTML>
<HEAD>
<TITLE>Determine if a system is using the large or small font setting.</TITLE>
<META NAME="Author" CONTENT="Harold Howe">
</HEAD>
<BODY BGCOLOR="WHITE">
<CENTER>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH="640">
<TR>
<TD>
<H3>
Determine if a system is using the large or small font setting.
</H3>
<P>
The easiest way to do this is to read the <TT>PixelsPerInch</TT>
property of the global <TT>Screen</TT> object. If the value is 96, then the
system is set to small fonts. If <TT>PixelsPerInch</TT> is 120, then the
large font setting is in effect. It is possible for <TT>PixelsPerInch</TT> to be
neither 96 or 120 because the user can set the font scaling factor directly.
</P>
<pre>
<b>__fastcall</b> TForm1<b>:</b><b>:</b>TForm1<b>(</b>TComponent<b>*</b> Owner<b>)</b>
<b>:</b> TForm<b>(</b>Owner<b>)</b>
<b>{</b>
<b>if</b><b>(</b>Screen<b>-></b>PixelsPerInch <b>==</b> <font color="blue">96</font><b>)</b>
Label1<b>-></b>Caption <b>=</b> <font color="blue">"Small fonts in use"</font><b>;</b>
<b>else</b> <b>if</b><b>(</b>Screen<b>-></b>PixelsPerInch <b>==</b> <font color="blue">120</font><b>)</b>
Label1<b>-></b>Caption <b>=</b> <font color="blue">"Large fonts in use"</font><b>;</b>
<b>else</b>
<b>{</b>
<b>float</b> Ratio <b>=</b> <b>(</b><b>(</b><b>float</b><b>)</b>Screen<b>-></b>PixelsPerInch<b>)</b> <b>/</b> <font color="blue">96.0</font><b>;</b>
Ratio <b>*</b><b>=</b> <font color="blue">100.0</font><b>;</b>
Label1<b>-></b>Caption <b>=</b> <font color="blue">"Fonts are set to "</font> <b>+</b>
IntToStr<b>(</b><b>(</b><b>int</b><b>)</b>Ratio<b>)</b> <b>+</b>
<font color="blue">" %"</font><b>;</b>
<b>}</b>
<b>}</b>
</pre>
</TD> </TR>
</TABLE>
</CENTER>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -