共用方式為


Report.ScaleTop 屬性 (Access)

當列印或預覽報表時使用CircleLinePsetPrint方法,或是其輸出儲存至檔案時,使用ScaleTop屬性來指定垂直座標的單位,這些垂直座標會描述頁面上邊緣的位置。 讀寫 Single

語法

運算式ScaleTop

表達 代表 Report 物件的變數。

註解

您可以使用區段的OnPrint屬性設定所指定的宏或Visual Basic事件程序來設定ScaleTop屬性。

使用這些屬性與相關的 ScaleHeightScaleWidth 屬性,您可以設定自訂的座標系統與正值與負值的座標。 總共四個這些規模屬性會以下列方式互動 ScaleMode 屬性:

  • 任何其他 Scale 屬性設定為任何值會自動將 ScaleMode 屬性設定為 0。

  • ScaleMode 屬性設定為數大於 0 變更 ScaleHeightScaleWidth 屬性設定為新的度量單位並將 ScaleLeftScaleTop 屬性設定為 0。 此外, CurrentXCurrentY 屬性設定變更以反映新的目前的點座標。

您也可以使用 Scale 方法陳述式中設定 ScaleHeightScaleWidthScaleLeftScaleTop 屬性。

注意事項

[!注意事項] ScaleTop 屬性不是 Top 屬性相同。

範例

下列範例使用 Circle 方法繪製圓形及圓形內建立圓形圖。 然後,它會使用 FillColorFillStyle 屬性將圓形圖配量設為紅色。 它也會從圓圈的左上角繪製一條線。

若要在 Microsoft Access 中嘗試此範例,請建立一個新報表。 將詳細資料區段的 OnPrint 屬性設定為 [事件程序]。 在報表的模組中輸入下列程式碼,然後切換至 [預覽列印]。

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer) 
 
 Const conPI = 3.14159265359 
 
 Dim sngHCtr As Single 
 Dim sngVCtr As Single 
 Dim sngRadius As Single 
 Dim sngStart As Single 
 Dim sngEnd As Single 
 
 sngHCtr = Me.ScaleWidth / 2 ' Horizontal center. 
 sngVCtr = Me.ScaleHeight / 2 ' Vertical center. 
 sngRadius = Me.ScaleHeight / 3 ' Circle radius. 
 Me.Circle (sngHCtr, sngVCtr), sngRadius ' Draw circle. 
 sngStart = -0.00000001 ' Start of pie slice. 
 
 sngEnd = -2 * conPI / 3 ' End of pie slice. 
 Me.FillColor = RGB(255, 0, 0) ' Color pie slice red. 
 Me.FillStyle = 0 ' Fill pie slice. 
 
 ' Draw Pie slice within circle 
 Me.Circle (sngHCtr, sngVCtr), sngRadius, , sngStart, sngEnd 
 
 ' Draw line to center of circle. 
 Dim intColor As Integer 
 Dim sngTop As Single, sngLeft As Single 
 Dim sngWidth As Single, sngHeight As Single 
 
 Me.ScaleMode = 3 ' Set scale to pixels. 
 sngTop = Me.ScaleTop ' Top inside edge. 
 sngLeft = Me.ScaleLeft ' Left inside edge. 
 sngWidth = Me.ScaleWidth / 2 ' Width inside edge. 
 sngHeight = Me.ScaleHeight / 2 ' Height inside edge. 
 intColor = RGB(255, 0, 0) ' Make color red. 
 
 ' Draw line. 
 Me.Line (sngTop, sngLeft)-(sngWidth, sngHeight), intColor 
 
End Sub

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應