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);

            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)


Does BitBlt return 0?

Can you not use gdest.CopyFromScreen(location, new Point(), new Size(1, 1)); to get the screen color?

How much of a difference is the color returned by GetColorAt and the test color.
Maybe you would be better off passing in the color and using gsrc.GetNearestColor(color) to ensure your test color is compatible with the source.
(I.E the screen color depth could be an issue.)