ComboBox.FontSize 屬性 (Access)ComboBox.FontSize property (Access)

您可以使用 FontSize 屬性可在下列情況中指定文字的點大小:You can use the FontSize property to specify the point size for text in the following situations:

  • 在表單及報表上顯示或列印控制項時。When displaying or printing controls on forms and reports.
  • 當在報表上使用 Print 方法。When using the Print method on a report.

可讀寫的 IntegerRead/write Integer.



_運算式_代表**ComboBox** 物件的變數。expression A variable that represents a ComboBox object.


FontSize 屬性使用下列設定值。The FontSize property uses the following settings.

設定Setting 描述Description
8 8 (除了命令按鈕以外所有報表及控制項的預設值) 文字是以 8 點的類型顯示。(Default for all reports and controls except command buttons) The text is 8-point type.
10 10 (命令按鈕的預設值) 文字是以 10 點的類型顯示。(Default for command buttons) The text is 10-point type.
其他大小Other sizes 文字以指定大小顯示。The text is the indicated size.

您可以在 Visual Basic 使用控制項的預設控制項樣式或**DefaultControl** 屬性來設定此屬性的預設值。You can set the default for this property by using a control's default control style or the DefaultControl property in Visual Basic.

對於報表,您可以設定這個屬性只能在一個事件程序或在 OnPrint 事件屬性設定值所指定的巨集。For reports, you can set this property only in an event procedure or in a macro specified by the OnPrint event property setting.

在 Visual Basic 中您要使用的字型所需的大小的數值運算式等於設定 FontSize 屬性。In Visual Basic, you set the FontSize property by using a numeric expression equal to the desired size of the font. FontSize 屬性的值可以是介於 1 到 127 個 (含) 之間。The setting for the FontSize property can be between 1 and 127, inclusive.


下列範例會使用 Print 方法來顯示名為 Report1 報表上的文字。The following example uses the Print method to display text on a report named Report1. 它會使用 TextWidthTextHeight 方法來垂直和水平置中的文字。It uses the TextWidth and TextHeight methods to center the text vertically and horizontally.

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

支援和意見反應Support and feedback

有關於 Office VBA 或這份文件的問題或意見反應嗎?Have questions or feedback about Office VBA or this documentation? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.