Results 1 to 9 of 9

Thread: Aquiring color of a pixel

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2000
    Location
    Geneve , Switzerland
    Posts
    64

    Red face Aquiring color of a pixel

    I very typical problem. When I have a file saved in a picture box, how can I aquire R (red) G(green) B(blue) of a pixel that have a coodinate of X and Y ?
    Thank ya
    What are the universe used for and why it's here ?

  2. #2
    Frenzied Member Buzby's Avatar
    Join Date
    Jan 1999
    Location
    UK
    Posts
    1,670
    Have a look at the Point method;

    (from the help file)

    Point Method


    Returns, as a long integer, the red-green-blue (RGB) color of the specified point on a Form or PictureBox. Doesn't support named arguments.

    Syntax

    object.Point(x, y)

    The Point method syntax has these parts:

    Part Description
    object Optional. An object expression that evaluates to an object in the Applies To list. If object is omitted, the Form object with the focus is assumed to be object.
    x, y Required. Single-precision values indicating the horizontal (x-axis) and vertical (y-axis) coordinates of the point in the ScaleMode property of the Form or PictureBox. Parentheses must enclose the values.


    Remarks

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


    --------------------------------------------------------------------------------
    'Buzby'
    Visual Basic Developer
    "I'm moving to Theory. Everything works there."

  3. #3

  4. #4

    Thread Starter
    Lively Member
    Join Date
    May 2000
    Location
    Geneve , Switzerland
    Posts
    64

    Talking YEAH !

    I really don't know how to thank ya ...
    What are the universe used for and why it's here ?

  5. #5
    How about your life savings?

  6. #6

    Thread Starter
    Lively Member
    Join Date
    May 2000
    Location
    Geneve , Switzerland
    Posts
    64

    Talking life saving ...

    I don't mind as it is a negetive number ....
    What are the universe used for and why it's here ?

  7. #7

  8. #8
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    If speed, or quality of code is an issue, then I would use the GetPixel() API instead.
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  9. #9
    Originally posted by plenderj
    If speed, or quality of code is an issue, then I would use the GetPixel() API instead.
    And if you end up using a control other than the PictureBox.

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