Report.ScaleWidth 屬性 (Access)
使用 ScaleWidth 屬性可指定當列印或預覽報表時使用 Circle、 Line、 Pset或 Print 方法,或其輸出儲存至檔案時,頁面的水準度量單位數目。 讀寫 Single。
語法
運算式。ScaleWidth
表達 代表 Report 物件的變數。
註解
預設設定是報表頁面的內部寬度,以 twip 為單位。
您可以使用區段的OnPrint屬性設定所指定的宏或Visual Basic事件程序來設定ScaleWidth屬性。
使用 ScaleWidth 屬性可建立用於繪圖或列印的自訂座標刻度。 例如, 語句 ScaleWidth = 100
會將區段的內部寬度定義為 100 個單位,或將一個水準單位定義為寬度的百分之一。
使用 ScaleMode 屬性來定義刻度根據度量單位,例如點、 像素、 字元、 英吋、 英寸、 公釐或公分為單位的標準單位。
將 ScaleWidth 屬性設定為正值會使座標值從左向右增加。 設定為負值會使座標值從右向左增加。
使用這些屬性與相關的 ScaleLeft 及 ScaleTop 屬性,您可以設定自訂的座標系統與正值與負值的座標。 總共四個這些規模屬性會以下列方式互動 ScaleMode 屬性:
任何其他 Scale 屬性設定為任何值會自動將 ScaleMode 屬性設定為 0。
ScaleMode 屬性設定為數大於 0 的 ScaleHeight 和 ScaleWidth 屬性變更至新的度量單位並將 ScaleLeft 及 ScaleTop 屬性設定為 0。 此外, CurrentX 和 CurrentY 屬性設定變更以反映新的目前的點座標。
您也可以使用 Scale 方法陳述式中設定 ScaleHeight 、 ScaleWidth 、 ScaleLeft 及 ScaleTop 屬性。
注意事項
ScaleWidth屬性與Width屬性不同。
範例
下列範例會使用 Print 方法,在名為 Report1的報表上顯示文字。 它會使用 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
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。