Point Method

See AlsoBI3X15              Example12GHDLC>Low

Returns the RGB color of the specified point on a form or picture box.

Syntax

[object.]Point(x,y)

Remarks

The Point method has these parts:

Part               Description

 

object            Object (non-MDI form or picture box) where the specified point is located.

x                   Single-precision value indicating the horizontal (x-axis) coordinate of the point, in the scale mode of the form or picture box.

y                   Single-precision value indicating the vertical (y-axis) coordinate of the point, in the scale mode of the form or picture box.

 

If the point referred to by the x and y coordinates is outside the object, the Point method returns -1.


See Also

Circle Method38E9WK

Line MethodGU01B0

Print Method9V51E5

PSet Method103J0PY


Point Method Example

The example uses the Point method to determine the color of a specific point on a form.  To try this example, paste the code into the Declarations section of a form.  Then press F5 and click the form.

 

Sub Form_Click ()

   Dim LeftColor, MidColor, Msg, RightColor  ' Declare variables.

   AutoRedraw = -1                           ' Turn on AutoRedraw.

   Height = 3 * 1440                         ' Set height to 3 inches.

   Width = 5 * 1440                          ' Set width to 5 inches.

   Backcolor = QBColor(1)                    ' Set background to blue.

   Forecolor = QBColor(4)                    ' Set foreground to red.

   Line (0, 0)-(Width / 3, Height), , BF     ' Red box.

   Forecolor = QBColor(15)                   ' Set foreground to white.

   Line (Width / 3, 0)-((Width / 3) * 2, Height), , BF

   LeftColor = Point(0, 0)                   ' Find color of left box,

   MidColor = Point(Width / 2, Height / 2)   ' Middle box, and

   RightColor = Point(Width, Height)         ' Right box.

   Msg = "The color number for the red box on the left side of "

   Msg = Msg & "the form is " & LeftColor & ". The "

   Msg = Msg & "color of the white box in the center is "

   Msg = Msg & MidColor & ". The color of the blue "

   Msg = Msg & "box on the right is " & RightColor & "."

   MsgBox Msg                                ' Display message.

End Sub