Exemplo n.º 1
0
        public HoverUI()
        {
            this.Shapes = new List <Shape>();

            Form.CheckForIllegalCrossThreadCalls = false;
            this.FormBorderStyle     = FormBorderStyle.None;
            this.Size                = Screen.PrimaryScreen.WorkingArea.Size;
            this.StartPosition       = FormStartPosition.Manual;
            this.Location            = new Point(0, 0);
            this.TopMost             = true;
            this.AllowTransparency   = true;
            this.BackColor           = Color.FromArgb(196, 255, 226);
            this.TransparencyKey     = Color.FromArgb(196, 255, 226);
            this.ShowIcon            = false;
            this.ShowInTaskbar       = false;
            this.OriginalWindowStyle = (IntPtr)((long)Interoperator.GetWindowLong(this.Handle, -20));
            this.PassthruWindowStyle = (IntPtr)((long)(uint)((int)Interoperator.GetWindowLong(this.Handle, -20) | 524288 | 32));
            this.SetWindowPassthru(true);

            this.canvas           = new BufferedPanel();
            this.canvas.Dock      = DockStyle.Fill;
            this.canvas.BackColor = Color.Transparent;
            this.canvas.BringToFront();
            this.canvas.Paint += CanvasRender;
            this.Controls.Add(this.canvas);
        }
Exemplo n.º 2
0
        public Color GetColorAtPixel(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 = Interoperator.BitBlt(hDC, 0, 0, 1, 1, hSrcDC, location.X, location.Y, (int)CopyPixelOperation.SourceCopy);
                    gdest.ReleaseHdc();
                    gsrc.ReleaseHdc();
                }
            }

            return(screenPixel.GetPixel(0, 0));
        }
Exemplo n.º 3
0
 public bool GetBackgroundKeyDown(Keys key)
 {
     return(Interoperator.GetAsyncKeyState(key) != 0);
 }
Exemplo n.º 4
0
 private bool IsApplicationIdle()
 {
     Interoperator.NativeMessage message;
     return(Interoperator.PeekMessage(out message, IntPtr.Zero, 0U, 0U, 0U) == 0);
 }
Exemplo n.º 5
0
 private void SetWindowPassthru(bool passthrough) => Interoperator.SetWindowLong(this.Handle, -20, passthrough ? PassthruWindowStyle : OriginalWindowStyle);