Example #1
0
        public void ScrollPanel(ScrollEventType type, ScrollOrientation orientation, int sign)
        {
            if (sign != 0)
            {
                ScrollProperties scroll;
                Func <Point, int, int, Point> func;
                if (orientation == ScrollOrientation.VerticalScroll)
                {
                    scroll = VerticalScroll;
                    func   = (p, sgn, stp) => new Point(-p.X, -p.Y + stp * sgn);
                }
                else
                {
                    scroll = HorizontalScroll;
                    func   = (p, sgn, stp) => new Point(-p.X + stp * sgn, -p.Y);
                }

                var step = type.HasFlag(ScrollEventType.LargeIncrement) || type.HasFlag(ScrollEventType.LargeDecrement)
                 ? scroll.LargeChange
                 : scroll.SmallChange;
                var oldValue = scroll.Value;
                AutoScrollPosition = func(AutoScrollPosition, sign, step);
                OnScroll(new ScrollEventArgs(type, oldValue, scroll.Value, orientation));
            }
        }
        /// <summary>TODO</summary>
        private void ScrollPanelCommon(ScrollEventType type, int sign, ScrollProperties scroll)
        {
            if (sign == 0)
            {
                return;
            }
            Func <Point, int, Point> func = (p, step) => new Point(-p.X, -p.Y + step * sign);

            AutoScrollPosition = func(AutoScrollPosition,
                                      type.HasFlag(ScrollEventType.LargeDecrement) ? scroll.LargeChange : scroll.SmallChange);
        }
        /// <summary>TODO</summary>
        public void ScrollPanel(ScrollEventType type, ScrollOrientation orientation, int sign)
        {
            if (sign != 0)
            {
                ScrollProperties scroll;
                Func<Point, int, int, Point> func;
                if (orientation == ScrollOrientation.VerticalScroll)
                {
                    scroll = VerticalScroll;
                    func = (p, sgn, stp) => new Point(-p.X, -p.Y + stp * sgn);
                }
                else
                {
                    scroll = HorizontalScroll;
                    func = (p, sgn, stp) => new Point(-p.X + stp * sgn, -p.Y);
                }

                var step = type.HasFlag(ScrollEventType.LargeIncrement) || type.HasFlag(ScrollEventType.LargeDecrement)
                         ? scroll.LargeChange
                         : scroll.SmallChange;
                var oldValue = scroll.Value;
                AutoScrollPosition = func(AutoScrollPosition, sign, step);
                OnScroll(new ScrollEventArgs(type, oldValue, scroll.Value, orientation));
            }
        }
Example #4
0
 private static int ScrollActionIndex(ScrollEventType type, ScrollOrientation orientation, int sign)
 => (type.HasFlag(ScrollEventType.SmallDecrement)        ? 4 : 0)
 + ((orientation == ScrollOrientation.HorizontalScroll) ? 2 : 0)
 + ((sign == +1)                                        ? 1 : 0);