// ------------------------------------------------------ // // Private Methods // // ------------------------------------------------------ #region Private Methods // Create a new proxy for one of the scroll bit items private ProxySimple CreateScrollBitsItem(ScrollBarItem index) { // For Scrollbars as standalone controls, make sure that the buttons are not invisible. (office scroll bars) // Checking is done from the return value of SetScrolBarInfo. NativeMethods.ScrollBarInfo sbi = new NativeMethods.ScrollBarInfo(); sbi.cbSize = Marshal.SizeOf(sbi.GetType()); if (_sbFlag != NativeMethods.SB_CTL || Misc.GetScrollBarInfo(_hwnd, NativeMethods.OBJID_CLIENT, ref sbi)) { return(new WindowsScrollBarBits(_hwnd, this, (int)index, _sbFlag)); } return(null); }
// Returns a Proxy element corresponding to the specified screen coordinates. internal override ProxySimple ElementProviderFromPoint(int x, int y) { for (ScrollBarItem item = ScrollBarItem.UpArrow; (int)item <= (int)ScrollBarItem.DownArrow; item = (ScrollBarItem)((int)item + 1)) { NativeMethods.Win32Rect rc = new NativeMethods.Win32Rect(WindowsScrollBarBits.GetBoundingRectangle(_hwnd, this, item, _sbFlag)); if (Misc.PtInRect(ref rc, x, y)) { return(new WindowsScrollBarBits(_hwnd, this, (int)item, _sbFlag)); } } return(this); }
// Returns the previous sibling element in the raw hierarchy. // Peripheral controls have always negative values. // Returns null is no previous. internal override ProxySimple GetPreviousSibling(ProxySimple child) { ScrollBarItem item = (ScrollBarItem)child._item; if (item != ScrollBarItem.UpArrow) { // skip the Large increment/decrement if there is no thumb if (item == ScrollBarItem.DownArrow && !IsScrollBarWithThumb(_hwnd, _sbFlag)) { item = ScrollBarItem.UpArrow + 1; } return(CreateScrollBitsItem((ScrollBarItem)((int)item - 1))); } return(null); }
// ------------------------------------------------------ // // Private Methods // // ------------------------------------------------------ #region Private Methods // Create a new proxy for one of the scroll bit items private ProxySimple CreateScrollBitsItem (ScrollBarItem index) { // For Scrollbars as standalone controls, make sure that the buttons are not invisible. (office scroll bars) // Checking is done from the return value of SetScrolBarInfo. NativeMethods.ScrollBarInfo sbi = new NativeMethods.ScrollBarInfo (); sbi.cbSize = Marshal.SizeOf (sbi.GetType ()); if (_sbFlag != NativeMethods.SB_CTL || Misc.GetScrollBarInfo(_hwnd, NativeMethods.OBJID_CLIENT, ref sbi)) { return new WindowsScrollBarBits (_hwnd, this, (int) index, _sbFlag); } return null; }