全部显示

ScaleTop 属性

       

在打印或预览报表时,或者将报表的输出保存为文件时,如果使用 CircleLinePsetPrint 方法,则可以使用 ScaleTop 属性来指定说明页面上边缘位置的垂直坐标单位数。Single 型,可读写。

expression.ScaleTop

expression   必需。返回“Applies To”列表中的一个对象的表达式。

说明

可以使用由OnPrint 属性设置指定的Visual Basic 事件过程来设置 ScaleTop 属性。

通过使用这些属性和相关的 ScaleHeightScaleWidth 属性,可以建立一个有正、负坐标值的自定义坐标系统。共有四个这样的“刻度”属性,它们采用以下方法与 ScaleMode 属性交互作用:

另外,也可以在一个语句中使用 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