ScaleMode Property
Applies To
Report.
Description
You can use the ScaleMode property in Visual Basic to specify the unit of measurement for coordinates on a page when the Circle, Line, PSet, or Print method is used while a report is previewed or printed, or its output is saved to a file.
Setting
The ScaleMode property uses the following settings.
Setting | Description |
|
0 | Custom values used by one or more of the ScaleHeight, ScaleWidth, ScaleLeft, and ScaleTop properties |
1 | (Default) Twips |
2 | Points |
3 | Pixels |
4 | Characters (horizontal = 120 twips per unit; vertical = 240 twips per unit) |
5 | Inches |
6 | Millimeters |
7 | Centimeters |
The property setting has an Integer value.
You can set the ScaleMode property by using a macro or a Visual Basic event procedure specified by a section's OnPrint property setting.
Remarks
By using the related ScaleHeight, ScaleWidth, ScaleLeft, and ScaleTop properties, you can create a custom coordinate system with both positive and negative coordinates. All four properties interact with the ScaleMode property in the following ways:
- Setting any other Scale property to any value automatically sets the ScaleMode property to 0.
- Setting the ScaleMode property to a number greater than 0 changes the ScaleHeight and ScaleWidth property settings to the new unit of measurement and sets the ScaleLeft and ScaleTop properties to 0. Also, the CurrentX and CurrentY property settings change to reflect the new coordinates of the current point.
See Also
Circle method, CurrentX, CurrentY properties, Event properties, Line method, Print method, PSet method, Scale method, ScaleHeight, ScaleWidth properties, ScaleLeft, ScaleTop properties.
Example
The following example uses the Print method to display text on a report named Report1. 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