Comment

PSet, Point

These two form methods give you fine control over colors. PSet lets you color an individual pixel. Point tells you the color of a specified pixel.

Usage

frmForm.PSet( [ nXCoord, nYCoord ] ) nColor = frmForm.Point( [ nXCoord, nYCoord ] )

Parameter

Value

Meaning

nXCoord, nYCoord

Numeric

The coordinates of the point of interest.

nColor

-1

The specified point is not in the form.

0 - 16,777,215

The color of the specified point.


If the coordinates are omitted for either method, the values of CurrentX and CurrentY are used. PSet sets the specified point to the current ForeColor. PSet interacts with DrawWidth—if DrawWidth is more than one, multiple pixels get colored. (In fact, at the resolutions we work at, we can't even see the colored pixel when DrawWidth is 1. Either that or no pixel gets colored when DrawWidth is 1.) The docs say the colored pixels are centered on the specified point. That's wrong in VFP 3—in that version, the colored pixels use the specified point as the upper-left corner.

In VFP 5 and later, when DrawWidth is greater than 2, the point you specify doesn't actually get colored. Instead, as we said, you get a box centered on the specified point. The confusing thing is that applying Point to that point immediately after "painting" it with PSet gives you not the foreground color, but the background color. See the examples to see how this works. In fact, FillStyle and FillColor determine what color that point actually is. It's as if you called the Box method.


These methods are not affected by ScaleMode—they always address individual pixels.

Example

* Color a few points _SCREEN.ForeColor = RGB(255, 0, 0) _SCREEN.PSet(100, 100)    && It's red, but hard to see ? _SCREEN.Point()           && Returns 255 _SCREEN.Cls _SCREEN.DrawWidth = 10 _SCREEN.PSet()            && Now you can see it ? _SCREEN.Point()         && Returns the value of BackColor ? _SCREEN.Point(100, 100) && So does this ? _SCREEN.Point(95, 95)   && This, however, gives you 255 ? _SCREEN.Point(95, 104)  && So does this and a number of others ? _SCREEN.Point(-10, -200)   && Returns -1 

See Also

Box, CurrentX, CurrentY, DrawWidth, FillColor, FillStyle, ForeColor, ScaleMode


View Updates

Copyright © 2002 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. All Rights Reserved.



Hacker's Guide to Visual FoxPro 7. 0
Hackers Guide to Visual FoxPro 7.0
ISBN: 1930919220
EAN: 2147483647
Year: 2001
Pages: 899

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net