Quote Originally Posted by Floby
Ok Sorry Will This is whats wrong ok Im using the Windows Libary and when using the Get pixel function like this where the paramaters are changed because i need the windows libary for something else
i cant get DC to work im kinda new to programming but i hope some one can help.

hbc := GetDC(null);
PixelColour := GetPixel(hbc,x1,y1);
Hi Floby,

You need to provide GetDC with a handle. In most cases if you can do things like this with a control, the control will have a handle property.

So, lets say you have a panel called myPanel and you want to look at pixel x1,y1. This is how you would do it.

[pascal]
var
dc : HDC;
col : TColor;

...

dc:=getDC(myPanel.handle);
col:=getPixel(dc,x1,y1);

...

[/pascal]

Hope this helps. If you are using a Borland compiler, you can sometimes get access to the controls canvas property. This provides a whole bunch of routines for drawing and doesn't require you to know about window handles and device contexts. One of the properties it provides is the pixels property (an array that provides access to the pixels of the canvas).