Report.CurrentY 屬性 (Access)Report.CurrentY property (Access)

您可以使用 CurrentY 屬性 (搭配 CurrentX 屬性) 指定下一個列印和繪圖方法在報表上的起始位置的水平及垂直座標。You can use the CurrentY property (along with the CurrentX property) to specify the horizontal and vertical coordinates for the starting position of the next printing and drawing method on a report. 可讀寫 單一Read/write Single.



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


例如,您可以使用這些屬性決定畫在報表區段上的圓之圓心位置。For example, you can use these properties to determine where the center point of a circle is drawn on a report section.

座標是從 [報告] 區段中所包含的 CurrentXCurrentY 屬性參照的左上角測量。The coordinates are measured from the upper-left corner of the report section that contains the reference to the CurrentX or CurrentY property. CurrentX 屬性設定為在區段的左邊緣、 0 和 CurrentY 屬性設定為 0 在其上邊緣。The CurrentX property setting is 0 at the section's left edge, and the CurrentY property setting is 0 at its top edge.

您可以在報表區段的**OnPrint** 屬性設定所指定的事件程序中設定CurrentXCurrentY屬性。You can set the CurrentX and CurrentY properties in an event procedure specified by the OnPrint property setting of a report section.

使用 ScaleMode 屬性定義測量單位,例如點、 像素、 字元、 英吋、 英寸、 公釐或公分為單位,將會依據座標。Use the ScaleMode property to define the unit of measure, such as points, pixels, characters, inches, millimeters, or centimeters, that the coordinates will be based on.

當您使用下列圖形方法時, CurrentXCurrentY 屬性設定的變更如下。When you use the following graphics methods, the CurrentX and CurrentY property settings are changed as indicated.

方法 Method 設定 CurrentX、CurrentY 屬性到Sets CurrentX, CurrentY properties to
CircleCircle 物件的中央。The center of the object.
LineLine 線條 ( x2、 _y2_座標) 的結束點。The end point of the line (the x2, y2 coordinates).
PrintPrint 下一個列印位置。The next print position.


下列範例會使用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.