示例#1
0
        /// <summary>
        /// Gets the color at a specific position.
        /// </summary>
        /// <param name="point">The position where from the color should be read.</param>
        /// <returns>The System.Drawing.Color at a specific position.</returns>
        public static Color GetColor(Point point)
        {
            LogPool.Append("Check for the color at the position x={0} y={1}.", point.X, point.Y);

            var hdcScreen = WinApi.CreateDC("Display", null, null, IntPtr.Zero);
            var cr        = WinApi.GetPixel(hdcScreen, (int)point.X, (int)point.Y);

            WinApi.DeleteDC(hdcScreen);

            return(Color.FromArgb((cr & 0x000000FF),
                                  (cr & 0x0000FF00) >> 8,
                                  (cr & 0x00FF0000) >> 16));
        }
示例#2
0
 public Gamma(string screenDeviceName)
 {
     createdDC = WinApi.CreateDC(null, screenDeviceName, null, IntPtr.Zero);
 }