Report.ScaleTop 属性 (Access)
使用 ScaleTop 属性可以指定垂直坐标的单位,这些坐标描述在打印或预览报表时使用 Circle、 Line、 Pset 或 Print 方法时,或其输出保存到文件中时,页面上边缘的位置。 读/写 Single。
语法
表达式。ScaleTop
表达 一个代表 Report 对象的变量。
备注
可以使用宏或由节的 OnPrint 属性设置指定的 Visual Basic 事件过程来设置 ScaleTop 属性。
通过使用这些属性和相关的 ScaleHeight 和 ScaleWidth 属性,您可以设置自定义的坐标系统使用正值和负值的坐标。 所有这四个比例属性按以下方式使用 ScaleMode 属性进行交互:
任何其他扩展属性设置为任何值自动设置 ScaleMode 属性为 0。
ScaleMode 属性设置为大于 0 ScaleHeight 和 ScaleWidth 属性的设置将更改为新的度量单位,并将 ScaleLeft 和 距离 属性设置为 0。 此外, CurrentX 和 当前 属性设置更改以反映当前点的新坐标。
您还可以使用 Scale 方法将 ScaleHeight 、 ScaleWidth 、 ScaleLeft 和 距离 属性设置在一个语句中。
注意
[!注释] 并不是 距离 属性 Top 属性相同。
示例
The following example uses the Circle method to draw a circle and create a pie slice within the circle. 然后,它使用 FillColor 和 FillStyle 属性将饼图切片着色为红色。 它还从左上方到圆心绘制一条线。
若要在 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 支持和反馈,获取有关如何接收支持和提供反馈的指南。