Scale 方法為 Report 對象定義坐標系統(tǒng)。
expression.Scale(flags, x1, y1, x2, y2)
expression 必需。返回“應用于”列表中的一個對象的表達式。
flags 必需 Integer 型。
x1 必需 Single 型。其值定義了對象左上角位置的水平坐標。
y1 必需 Single 型。其值定義了對象左上角位置的垂直坐標。
x2 必需 Single 型。其值定義了對象右下角位置的水平坐標。
y2 必需 Single 型。其值定義了對象右下角位置的垂直坐標。
只能在由報表節(jié)的 OnPrint 或 OnFormat 事件屬性,或報表的 OnPage 事件屬性所指定的事件過程或宏中使用該屬性。
可以使用 Scale 方法將坐標系統(tǒng)重新設置為所選擇的任何比例。使用不帶任何參數(shù)的 Scale 方法,將會使坐標系統(tǒng)重新設置為緹。Scale 方法影響 Print 方法和報表圖形方法(包括 Circle、Line 和 PSet 方法)的坐標系統(tǒng)。
下面的示例用一種比例畫一個圓,然后使用 Scale 方法來更改比例,并用新的比例來畫另一個圓。
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
DrawCircle
End Sub
Sub DrawCircle()
Dim sngHCtr As Single, sngVCtr As Single
Dim sngNewH As Single, sngNewV As Single
Dim sngRadius As Single
Me.ScaleMode = 3 ' Set scale to pixels.
sngHCtr = Me.ScaleWidth / 2 ' Horizontal center.
sngVCtr = Me.ScaleHeight / 2 ' Vertical center.
sngRadius = Me.ScaleHeight / 3 ' Circle radius.
' Draw circle.
Me.Circle (sngHCtr, sngVCtr), sngRadius
' New horizontal scale.
sngNewH = Me.ScaleWidth * 0.9
' New vertical scale.
sngNewV = Me.ScaleHeight * 0.9
' Change to new scale.
Me.Scale(0, 0)-(sngNewH, sngNewV)
' Draw circle.
Me.Circle (sngHCtr + 100, sngVCtr), sngRadius, RGB(0, 256, 0)
End Sub