private void RegisterBar()
        {
            Native.APPBARDATA abd = new Native.APPBARDATA();
            abd.cbSize = (uint)Marshal.SizeOf(abd);
            abd.hWnd   = this.Handle;
            if (!fBarRegistered)
            {
                uCallBack            = (uint)Native.RegisterWindowMessage("AppBarMessage");
                abd.uCallbackMessage = uCallBack;

                uint ret = Native.SHAppBarMessage(Native.ABMsg.New, ref abd);
                fBarRegistered = true;

                ABSetPos();
            }
            else
            {
                Native.SHAppBarMessage(Native.ABMsg.Remove, ref abd);
                fBarRegistered = false;
            }
        }
        /// <summary>
        /// Change size and alert all windows that the working area has changed (if signal=true)
        /// </summary>
        private void ABSetPos(bool signal)
        {
            Native.APPBARDATA abd = new Native.APPBARDATA();
            abd.cbSize = (uint)Marshal.SizeOf(abd);
            abd.hWnd   = this.Handle;
            abd.uEdge  = TaskbarLocation;

            int height = TaskbarPropertiesManager.Instance.Properties.HeightMultiplier * BaseSize;
            int width  = TaskbarPropertiesManager.Instance.Properties.Width;

            if (abd.uEdge == (int)Native.ABEdge.Left || abd.uEdge == Native.ABEdge.Right)
            {
                if (IsHidden)
                {
                    width = 2;
                }

                abd.rc.top    = CurrentScreen.Bounds.Top;
                abd.rc.bottom = CurrentScreen.Bounds.Bottom;
                if (abd.uEdge == (int)Native.ABEdge.Left)
                {
                    abd.rc.left  = CurrentScreen.Bounds.Left;
                    abd.rc.right = abd.rc.left + width;
                }
                else
                {
                    abd.rc.right = CurrentScreen.Bounds.Right;
                    abd.rc.left  = abd.rc.right - width;
                }
            }
            else
            {
                if (IsHidden)
                {
                    height = 2;
                }

                abd.rc.left  = CurrentScreen.Bounds.Left;
                abd.rc.right = CurrentScreen.Bounds.Right;
                if (abd.uEdge == Native.ABEdge.Top)
                {
                    abd.rc.top    = CurrentScreen.Bounds.Top;
                    abd.rc.bottom = abd.rc.top + height;
                }
                else
                {
                    abd.rc.bottom = CurrentScreen.Bounds.Bottom;
                    abd.rc.top    = abd.rc.bottom - height;
                }
            }

            // Query the system for an approved size and position.
            Native.SHAppBarMessage(Native.ABMsg.QueryPos, ref abd);

            // Adjust the rectangle, depending on the edge to which the
            // appbar is anchored.
            switch (abd.uEdge)
            {
            case Native.ABEdge.Left:
                abd.rc.right = abd.rc.left + width;
                break;

            case Native.ABEdge.Right:
                abd.rc.left = abd.rc.right - width;
                break;

            case Native.ABEdge.Top:
                abd.rc.bottom = abd.rc.top + height;
                break;

            case Native.ABEdge.Bottom:
                abd.rc.top = abd.rc.bottom - height;
                break;
            }

            if (signal)
            {
                // Pass the final bounding rectangle to the system.
                Native.SHAppBarMessage(Native.ABMsg.SetPos, ref abd);
            }

            // Move and size the appbar so that it conforms to the
            // bounding rectangle passed to the system.
            Native.MoveWindow(abd.hWnd, abd.rc.left, abd.rc.top,
                              abd.rc.right - abd.rc.left, abd.rc.bottom - abd.rc.top, true);
        }