全部显示

ScaleWidth 属性

       

在打印或预览报表,或者将报表的输出保存为文件时,如果使用 CircleLinePsetPrint 方法,则可以使用 ScaleWidth 属性来指定页面的水平度量单位数。Single 型,可读写。

expression.ScaleWidth

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

说明

默认设置是以为单位的报表页面内部宽度。

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

使用 ScaleWidth 属性可以创建一个绘图或打印用的自定义坐标刻度。例如,语句 ScaleWidth = 100 定义节的内部宽度为 100 个单位,或者水平坐标的单位为宽度的 1/100。

使用 ScaleMode 属性可以定义一个基于标准测量单位的刻度,如像素、字符、英寸、毫米或厘米。

ScaleWidth 属性设为正值会使坐标值从左往右增加,将其设为负值会使坐标值从右往左增加。

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

也可以在一个语句中使用 Scale 方法对 ScaleHeightScaleWidthScaleLeftScaleTop 属性进行设置。

注意   ScaleWidth 属性与 Width 属性不同。

示例

以下示例使用 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