(Access) 的 Report.CurrentY 屬性

使用 CurrentY 屬性 (以及 CurrentX 屬性) 來指定報表上下一個列印和繪圖方法開始位置的水準和垂直座標。 讀寫 Single

語法

運算式CurrentY

表達 代表 Report 物件的變數。

註解

例如,您可以使用這些屬性決定畫在報表區段上的圓之圓心位置。

座標是從 [報告] 區段中所包含的 CurrentXCurrentY 屬性參照的左上角測量。 CurrentX 屬性設定為在區段的左邊緣、 0 和 CurrentY 屬性設定為 0 在其上邊緣。

您可以在報表區段的OnPrint屬性設定所指定的事件程序中設定CurrentXCurrentY屬性。

使用 ScaleMode 屬性定義測量單位,例如點、 像素、 字元、 英吋、 英寸、 公釐或公分為單位,將會依據座標。

當您使用下列圖形方法時, CurrentXCurrentY 屬性設定的變更如下。

方法 設定 CurrentX、CurrentY 屬性到
Circle 物件的中央。
Line 線條的終點 (x2y2 座標) 。
Print 下一個列印位置。

範例

下列範例會使用 Print 方法,在名為 Report1的報表上顯示文字。 它會使用 TextWidthTextHeight 方法來垂直和水平置中的文字。

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 支援與意見反應