Anyone know why this wouldnt work all color values are correct
Bitmap screenPixel = new Bitmap(1, 1, PixelFormat.Format32bppArgb);
public Color GetColorAt(Point location)
{
using (Graphics gdest = Graphics.FromImage(screenPixel))
{
using (Graphics gsrc = Graphics.FromHwnd(IntPtr.Zero))
{
IntPtr hSrcDC = gsrc.GetHdc();
IntPtr hDC = gdest.GetHdc();
int retval = BitBlt(hDC, 0, 0, 1, 1, hSrcDC, location.X, location.Y, (int)CopyPixelOperation.SourceCopy);
gdest.ReleaseHdc();
gsrc.ReleaseHdc();
}
}
return screenPixel.GetPixel(0, 0);
}
THEN I use this to check if color on screen is the same as what i want and then use if else statement
Color color = Color.FromArgb(255, 246, 201, 72);
Point greycfpoint = new Point(468, 544);
var c = GetColorAt(greycfpoint);
if (c.R == color.R && c.G == color.G && c.B == color.B)
{
cheers!!