internal NativeMethods.Win32Rect CalculateRectNoHeader() { NativeMethods.Win32Rect rcLv = NativeMethods.Win32Rect.Empty; if (!Misc.GetWindowRect(_hwnd, ref rcLv)) { return(NativeMethods.Win32Rect.Empty); } // set top to the top coordinate of the first item NativeMethods.Win32Rect item; WindowsListView.GetItemRect(_hwnd, _items[0], NativeMethods.LVIR_BOUNDS, out item); NativeMethods.Win32Rect groupRc; groupRc.top = item.top; // left coordinate defined by the left coordinate of the listview groupRc.left = rcLv.left; int count = Count; // bottom defined by the bottom coordinate of the last item if (count > 1) { // get the rect of the last item in the group WindowsListView.GetItemRect(_hwnd, _items[count - 1], NativeMethods.LVIR_BOUNDS, out item); } groupRc.bottom = item.bottom; // right coordinate defined by lv.right groupRc.right = rcLv.right; // when vertical scrollbar is present take it into account if (WindowScroll.Scrollable(_hwnd, NativeMethods.SB_VERT)) { NativeMethods.Win32Rect rc = GetScrollbarRect(); int width = rc.right - rc.left; if (Misc.IsControlRTL(_hwnd)) { // Right to left mirroring style groupRc.left += width; } else { groupRc.right -= width; } } return(groupRc); }
//------------------------------------------------------ // // Patterns Implementation // //------------------------------------------------------ #region ProxySimple Interface // Returns a pattern interface if supported. internal override object GetPatternProvider(AutomationPattern iid) { return((iid == RangeValuePattern.Pattern && WindowScroll.Scrollable(_hwnd, _sbFlag) && HasValuePattern(_hwnd, _sbFlag)) ? this : null); }