使用 ForeSize 属性可以在以下情况中为文本指定磅值大小。
Integer 型,可读/写。
expression.FontSize
expression 必需。返回“Applies To”列表中的一个对象的表达式。
FontSize 属性使用以下的设置:
| 设置 | 说明 | 
|---|---|
| 8 | (除了命令按钮之外所有报表及控件的默认值)文本为 8 磅大小。 | 
| 10 | (命令按钮的默认值)文本为 10 磅大小。 | 
| 其他大小 | 文本以指定大小显示。 | 
也可以单击“格式(窗体/报表)”工具栏上的“字号”框来设置该属性。
使用控件的默认控件样式或在 Visual Basic 中使用 DefaultControl 可以设置该属性的默认值。
对于报表,只能在 OnPrint 事件属性设置所指定的事件过程或宏中设置该属性。
在 Visual Basic 中,可以使用属性等于所需字号的数字表达式设置 FontSize。FontSize 属性设置值介于 1 和 127 之间,包含 1 与 127。
以下示例使用 Print 方法来显示名为“报表1”的报表上的文本。它使用 TextWidth 和 TextHeight 方法,使文本在垂直和水平方向上居中。
Private Sub Detail_Format(Cancel As Integer, _
        FormatCount As Integer)
    Dim rpt as Report
    Dim strMessage As String
    Dim intHorSize As Integer, intVerSize As Integer
    Set rpt = Me
    strMessage = "DisplayMessage"
    With rpt
        'Set scale to pixels, and set FontName and
        'FontSize properties.
        .ScaleMode = 3
        .FontName = "Courier"
        .FontSize = 24
    End With
    ' Horizontal width.
    intHorSize = Rpt.TextWidth(strMessage)
    ' Vertical height.
    intVerSize = Rpt.TextHeight(strMessage)
    ' Calculate location of text to be displayed.
    Rpt.CurrentX = (Rpt.ScaleWidth/2) - (intHorSize/2)
    Rpt.CurrentY = (Rpt.ScaleHeight/2) - (intVerSize/2)
    ' Print text on Report object.
    Rpt.Print strMessage
End Sub