/// <summary> /// Feeds mouse Wheel. If applied on a IScrollableItem it's sended to it /// </summary> /// <param name="e"></param> /// <returns>True if handled. False otherwise</returns> internal static bool FeedMouseWheel(MouseEventArgs e) { RibbonDropDown dd = LastPopup as RibbonDropDown; if (dd != null) { foreach (RibbonItem item in dd.Items) { if (dd.RectangleToScreen(item.Bounds).Contains(e.Location)) { IScrollableRibbonItem sc = item as IScrollableRibbonItem; if (sc != null) { if (e.Delta < 0) { sc.ScrollDown(); } else { sc.ScrollUp(); } return(true); } } } } return(false); }
/// <summary> /// Feeds mouse Wheel. If applied on a IScrollableItem it's sended to it /// </summary> /// <param name="e"></param> /// <returns>True if handled. False otherwise</returns> internal static bool FeedMouseWheel(MouseEventArgs e) { RibbonDropDown dd = LastPopup as RibbonDropDown; if (dd != null) { WinApi.POINT pos; if (WinApi.GetCursorPos(out pos)) { foreach (RibbonItem item in dd.Items) { if (dd.RectangleToScreen(item.Bounds).Contains(pos.x, pos.y)) //if (dd.RectangleToScreen(item.Bounds).Contains(e.Location)) { IScrollableRibbonItem sc = item as IScrollableRibbonItem; if (sc != null) { if (e.Delta < 0) { sc.ScrollDown(); } else { sc.ScrollUp(); } return(true); } } } } } //kevin carbis - added scrollbar support to dropdowns so we need to feed the mouse wheel to the //actual dropdown item if it was not intended for a child item. if (dd != null) { if (e.Delta < 0) { dd.ScrollDown(); } else { dd.ScrollUp(); } return(true); } return(false); }