Exemplo n.º 1
0
        public static void InvertScreenRect(IntPtr hwnd, Rectangle rect)
        {
            Winapi.RECT rect2;

            var loc = Winapi.GetWindowRect(hwnd).Location;

            rect.Offset(-loc.X, -loc.Y);
            var hdc = Winapi.GetWindowDC(hwnd);

            //top edge
            rect2 = new Winapi.RECT(rect.Left, rect.Top, rect.Right, rect.Top + INVERT_BORDER);
            InvertRect(hdc, ref rect2);

            //left edge
            rect2 = new Winapi.RECT(rect.Left, rect.Top + INVERT_BORDER, rect.Left + INVERT_BORDER, rect.Bottom - INVERT_BORDER);
            InvertRect(hdc, ref rect2);

            //right edge
            rect2 = new Winapi.RECT(rect.Right - INVERT_BORDER, rect.Top + INVERT_BORDER, rect.Right, rect.Bottom - INVERT_BORDER);
            InvertRect(hdc, ref rect2);

            //bottom edge
            rect2 = new Winapi.RECT(rect.Left, rect.Bottom - INVERT_BORDER, rect.Right, rect.Bottom);
            InvertRect(hdc, ref rect2);

            Winapi.ReleaseDC(hwnd, hdc);
        }
Exemplo n.º 2
0
 static extern bool OffsetRect(ref Winapi.RECT lprc, int dx, int dy);
Exemplo n.º 3
0
 static extern bool SetRect(out Winapi.RECT lprc, int xLeft, int yTop, int xRight, int yBottom);
Exemplo n.º 4
0
 static extern bool InvertRect(IntPtr hDC, [In] ref Winapi.RECT lprc);