Пример #1
0
        // Create the approiate child this can return null if that child does not exist
        internal ProxyFragment CreateNonClientChild(NonClientItem item)
        {
            switch (item)
            {
            case NonClientItem.HScrollBar:
                if (WindowsScrollBar.HasHorizontalScrollBar(_hwnd))
                {
                    // the listview needs special handling WindowsListViewScrollBar inherits from WindowsScrollBar
                    // and overrides some of its behavoir
                    if (Misc.ProxyGetClassName(_hwnd) == "SysListView32")
                    {
                        return(new WindowsListViewScrollBar(_hwnd, this, (int)item, NativeMethods.SB_HORZ));
                    }
                    else
                    {
                        return(new WindowsScrollBar(_hwnd, this, (int)item, NativeMethods.SB_HORZ));
                    }
                }
                break;

            case NonClientItem.VScrollBar:
                if (WindowsScrollBar.HasVerticalScrollBar(_hwnd))
                {
                    // the listview needs special handling WindowsListViewScrollBar inherits from WindowsScrollBar
                    // and overrides some of its behavoir
                    if (Misc.ProxyGetClassName(_hwnd) == "SysListView32")
                    {
                        return(new WindowsListViewScrollBar(_hwnd, this, (int)item, NativeMethods.SB_VERT));
                    }
                    else
                    {
                        return(new WindowsScrollBar(_hwnd, this, (int)item, NativeMethods.SB_VERT));
                    }
                }
                break;

            case NonClientItem.TitleBar:
            {
                // Note 2 checks above will succeed for the win32popup menu, hence adding this last one
                if (WindowsTitleBar.HasTitleBar(_hwnd))
                {
                    return(new WindowsTitleBar(_hwnd, this, (int)item));
                }
                break;
            }

            case NonClientItem.Menu:
            {
                return(CreateNonClientMenu());
            }

            case NonClientItem.Grip:
            {
                int style = WindowStyle;
                if (Misc.IsBitSet(style, NativeMethods.WS_VSCROLL) && Misc.IsBitSet(style, NativeMethods.WS_HSCROLL))
                {
                    if (WindowsGrip.IsGripPresent(_hwnd, false))
                    {
                        return(new WindowsGrip(_hwnd, this, (int)item));
                    }
                }
                break;
            }

            default:
                return(null);
            }

            return(null);
        }