Exemplo n.º 1
0
        public void FreeSpace()
        {
            this.reservedWidth = 0;
            WinAPI.RECT trayRect     = this.GetTrayRect();
            WinAPI.RECT rebarRect    = this.GetRebarRect();
            WinAPI.RECT minimizeRect = this.GetMinimizeRect();
            int         cx1          = minimizeRect.Right - minimizeRect.Left;

            WinAPI.RECT lpRect1;
            WinAPI.GetWindowRect(WinAPI.FindWindowEx(this.trayHwnd, IntPtr.Zero, "TrayClockWClass", (string)null), out lpRect1);
            int num1 = lpRect1.Right - lpRect1.Left;

            WinAPI.RECT lpRect2;
            WinAPI.GetWindowRect(WinAPI.FindWindowEx(this.trayHwnd, IntPtr.Zero, "SysPager", (string)null), out lpRect2);
            int num2 = lpRect2.Right - lpRect2.Left;

            WinAPI.RECT lpRect3;
            WinAPI.GetWindowRect(WinAPI.FindWindowEx(this.trayHwnd, IntPtr.Zero, "Button", (string)null), out lpRect3);
            int num3 = lpRect3.Right - lpRect3.Left;
            int cx2  = cx1 + num1 + num2 + num3;

            WinAPI.SetWindowPos(this.trayHwnd, IntPtr.Zero, SystemInformation.WorkingArea.Right - cx2, 0, cx2, trayRect.Bottom - trayRect.Top, (WinAPI.SetWindowPosFlags) 0);
            WinAPI.SetWindowPos(this.rebarHwnd, IntPtr.Zero, rebarRect.Left, 0, SystemInformation.WorkingArea.Right - cx2 - rebarRect.Left, trayRect.Bottom - trayRect.Top, WinAPI.SetWindowPosFlags.SWP_NOMOVE);
            WinAPI.SetWindowPos(this.minimizeHwnd, IntPtr.Zero, cx2 - cx1, 0, cx1, minimizeRect.Bottom - minimizeRect.Top, WinAPI.SetWindowPosFlags.SWP_NOSIZE);
        }
Exemplo n.º 2
0
        public void PlaceMinimizeOnTaskbar()
        {
            WinAPI.SetParent(this.minimizeHwnd, this.taskbarHwnd);
            WinAPI.RECT minimizeRect = this.GetMinimizeRect();
            int         cx           = minimizeRect.Right - minimizeRect.Left;

            WinAPI.SetWindowPos(this.minimizeHwnd, IntPtr.Zero, SystemInformation.WorkingArea.Right - cx, 0, cx, minimizeRect.Bottom - minimizeRect.Top, WinAPI.SetWindowPosFlags.SWP_NOSIZE);
            WinAPI.RECT trayRect = this.GetTrayRect();
            int         num      = trayRect.Right - trayRect.Left;

            WinAPI.SetWindowPos(this.trayHwnd, IntPtr.Zero, SystemInformation.WorkingArea.Right - this.reservedWidth - num - cx, 0, num - cx, trayRect.Bottom - trayRect.Top, (WinAPI.SetWindowPosFlags) 0);
        }
Exemplo n.º 3
0
        public void AddControl(UserControl control)
        {
            WinAPI.RECT trayRect = this.GetTrayRect();
            int         num1     = trayRect.Right - trayRect.Left;

            WinAPI.RECT minimizeRect = this.GetMinimizeRect();
            int         num2         = minimizeRect.Right - minimizeRect.Left;

            this.reservedWidth = control.Width + 5;
            control.Left       = num1 - num2;
            WinAPI.SetParent(control.Handle, this.trayHwnd);
            this.control = (Control)control;
        }
Exemplo n.º 4
0
        public bool CheckTrayWidth()
        {
            WinAPI.RECT trayRect = this.GetTrayRect();
            int         num1     = trayRect.Right - trayRect.Left;

            WinAPI.RECT minimizeRect = this.GetMinimizeRect();
            int         num2         = minimizeRect.Right - minimizeRect.Left;

            WinAPI.RECT lpRect1;
            WinAPI.GetWindowRect(WinAPI.FindWindowEx(this.trayHwnd, IntPtr.Zero, "TrayClockWClass", (string)null), out lpRect1);
            int num3 = lpRect1.Right - lpRect1.Left;

            WinAPI.RECT lpRect2;
            WinAPI.GetWindowRect(WinAPI.FindWindowEx(this.trayHwnd, IntPtr.Zero, "SysPager", (string)null), out lpRect2);
            int num4 = lpRect2.Right - lpRect2.Left;

            WinAPI.RECT lpRect3;
            WinAPI.GetWindowRect(WinAPI.FindWindowEx(this.trayHwnd, IntPtr.Zero, "Button", (string)null), out lpRect3);
            int num5 = lpRect3.Right - lpRect3.Left;

            return(num1 == num2 + num3 + num4 + num5 + this.reservedWidth);
        }
Exemplo n.º 5
0
 public static extern bool GetWindowRect(IntPtr hwnd, out WinAPI.RECT lpRect);