예제 #1
0
        /// <summary>
        /// Checks if a Pixel value in the process is the same as paramter passed through
        /// </summary>
        /// <param name="LocationToCheck"> Location of the pixel to check against </param>
        /// <param name="ColourToCheck"> Colour of the pixel to check against </param>
        /// <param name="ClickPixel"> If true pixel will be left clicked </param>
        /// <returns> True/False Depending on weather the pixel value matched.</returns>
        public static Boolean CheckPixelValue(Point LocationToCheck, Color ColourToCheck, Boolean ClickPixel = false)
        {
            Bitmap bmp                 = WindowCapture.CaptureApplication(GlobalVariables.GLOBAL_PROC_NAME);
            Point  ProcessLocation     = WindowCapture.GetProcessPosition(GlobalVariables.GLOBAL_PROC_NAME);
            Point  PixelScreenLocation = new Point(LocationToCheck.X + ProcessLocation.X, LocationToCheck.Y + ProcessLocation.Y);

            if (bmp.GetPixel(LocationToCheck.X, LocationToCheck.Y) == ColourToCheck)
            {
                if (ClickPixel)
                {
                    MouseHandler.MoveCursor(PixelScreenLocation);
                    MouseHandler.MouseLeftClick();
                }

                return(true);
            }

            return(false);
        }