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
Printable View
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
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.
--------------------------------------------------------------------------------
Getting the RGB compontents is a bit trickier:
http://www.vbforums.com/showthread.p...&highlight=rgb
I really don't know how to thank ya ...
How about your life savings? :D
I don't mind as it is a negetive number ....
Dammit. :D
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.Quote:
Originally posted by plenderj
If speed, or quality of code is an issue, then I would use the GetPixel() API instead.