Report.PSet Method (Access)
The PSet method sets a point on a Report object to a specified color when the Print event occurs.
Syntax
식 .PSet(flags, X, Y, color)
식 A variable that represents a Report object.
Parameters
Name |
Required/Optional |
Data Type |
Description |
---|---|---|---|
flags |
필수 |
Integer |
A keyword that indicates the coordinates are relative to the current graphics position given by the settings for the CurrentX and CurrentY properties of the object argument. |
X |
필수 |
Single |
The horizontal coordinate of the point to set. |
Y |
필수 |
Single |
The vertical coordinate of the point to set. |
color |
필수 |
Long |
the RGB (red-green-blue) color to set the point to. If this argument is omitted, the value of the ForeColor property is used. You can also use the RGB function or QBColor function to specify the color. |
Return Value
Nothing
Remarks
The size of the point depends on the DrawWidth property setting. When the DrawWidth property is set to 1, the PSet method sets a single pixel to the specified color. When the DrawWidth property is greater than 1, the point is centered on the specified coordinates.
The way the point is drawn depends on the settings of the DrawMode and DrawStyle properties.
When you apply the PSet method, the CurrentX and CurrentY properties are set to the point specified by the x and y arguments.
To clear a single pixel with the PSet method, specify the coordinates of the pixel and use &HFFFFFF (white) as the color argument.
Example
The following example uses the PSet method to draw a line through the horizontal axis of a report.
To try this example in Microsoft Access, create a new report. Set the OnPrint property of the Detail section to [Event Procedure]. Enter the following code in the report's module, then switch to Print Preview.
Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Dim sngMidPt As Single, intI As Integer
' Set scale to pixels.
Me.ScaleMode = 3
' Calculate midpoint.
sngMidPt = Me.ScaleHeight / 2
' Loop to draw line down horizontal axis pixel by pixel.
For intI = 1 To Me.ScaleWidth
Me.PSet(intI, sngMidPt)
Next intI
End Sub