PSet Method

Applies To

Report Object.

Description

The PSet method sets a point on a Report object to a specified color when the Print event occurs.

Syntax

object.PSet [Step](x, y)[, color]

You can use this method only in an event procedure or a macro specified by the event properties OnPrint or OnFormat for a report section, or OnPage for a report.

The PSet method uses the following arguments.

Argument

Description

object

The Report object on which the point is to be drawn.

Step

A key word that indicates the coordinates are relative to the current graphics position given by the settings for the CurrentX and CurrentY properties of object.

x, y

Single values indicating the horizontal and vertical coordinates of the point to set.

color

An RGB (red-green-blue) color to set the point to. If this argument is omitted, the current foreground color is used. You can also use the RGB function or the QBColor function to specify the color.


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 white (&HFFFFFF) as the color argument.

See Also

CurrentX, CurrentY Properties; DrawMode Property; DrawStyle Property; DrawWidth Property; Event Properties; Print Event; QBColor Function; RGB Function.

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 by clicking the New button on the Reports tab of the Database window. 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

    rpt.ScaleMode = 3                        ' Set scale to pixels.
    sngMidPt = rpt.ScaleHeight / 2            ' Calculate midpoint.
    ' Loop to draw line down horizontal axis pixel by pixel.
    For intI = 1 To rpt.ScaleWidth
        rpt.PSet(intI, sngMidPt)
    Next intISub

Tip It’s faster to draw a line using the Line method rather than the PSet method.