Esempio n. 1
0
        public static Color GetColorAt(int x, int y)
        {
            var desk = InteropMethods.GetDesktopWindow();
            var dc   = InteropMethods.GetWindowDC(desk);
            var a    = (int)InteropMethods.GetPixel(dc, x, y);

            InteropMethods.ReleaseDC(desk, dc);
            return(Color.FromArgb(255, (byte)((a >> 0) & 0xff), (byte)((a >> 8) & 0xff), (byte)((a >> 16) & 0xff)));
        }
Esempio n. 2
0
 private static void Window_SourceInitialized(object sender, EventArgs e)
 {
     if (sender is System.Windows.Window window)
     {
         var _ = new WindowInteropHelper(window)
         {
             Owner = InteropMethods.GetDesktopWindow()
         };
     }
 }