Results 1 to 6 of 6

Thread: Point Function

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2005
    Posts
    2

    Point Function

    Hi All,

    Point function of Form object returns color of the pixel at a
    partcular location on the form.

    I tried to use this function in a project of Graphics.

    I found that the behaviour of the function was strange.

    Sometimes, the function returned a color value upon clicking
    a pixel on form.

    Other times, it simply falied to return anything.
    It just kept returning -1 eventhought the color of the pixel was red.

    The same code worked on other PCs while on still others it failed.

    Can anyone explain why Point function behaves like this ?

    I need a quick reply.

    Thank you.

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Point Function

    The Point function normally returns -1 if the coordinates you specify is outside of the Form border. Could you post the code you used?

  3. #3
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: Point Function

    I think it even returns -1 if the mouse cursor is over objects as well. Correct me if I'm wrong but I remember that happening to me in the past.

  4. #4
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Point Function

    That is true unless the ClipControls property is set to False.

  5. #5

    Thread Starter
    New Member
    Join Date
    Nov 2005
    Posts
    2

    Re: Point Function

    Hi Jacob,
    Here is the code you want.
    If you know computer graphics, it is about BoundaryFill Algorithm that fills
    a polygon. If you need any further code, just inform me. Thanks.

    Public Sub BoundaryFill4(xf As Single, yf As Single, FillCol As ColorConstants, BoundaryCol As ColorConstants)



    Dim current As ColorConstants

    current = Point(xf, yf)



    If ((current <> BoundaryCol) And (current <> FillCol)) Then

    Me.PSet (xf, yf), FillCol

    Call BoundaryFill4(xf + 1, yf, FillCol, BoundaryCol)

    Call BoundaryFill4(xf - 1, yf, FillCol, BoundaryCol)

    Call BoundaryFill4(xf, yf + 1, FillCol, BoundaryCol)

    Call BoundaryFill4(xf, yf - 1, FillCol, BoundaryCol)

    End If

  6. #6
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Point Function

    Does that solve your problem?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width