public ScrollEventArgs(ScrollEventType type, int oldValue, int newValue, ScrollOrientation scroll)
 {
     _scrollType = type;
     _oldValue = oldValue;
     NewValue = newValue;
     _scrollOrientation = scroll;
 }
        private void OnScroll(ScrollEventType type, int oldValue, int newValue, ScrollOrientation orientation)
        {
            if (Scroll == null) return;

            if (orientation == ScrollOrientation.HorizontalScroll)
            {
                if (type != ScrollEventType.EndScroll && isFirstScrollEventHorizontal)
                {
                    type = ScrollEventType.First;
                }
                else if (!isFirstScrollEventHorizontal && type == ScrollEventType.EndScroll)
                {
                    isFirstScrollEventHorizontal = true;
                }
            }
            else
            {
                if (type != ScrollEventType.EndScroll && isFirstScrollEventVertical)
                {
                    type = ScrollEventType.First;
                }
                else if (!isFirstScrollEventHorizontal && type == ScrollEventType.EndScroll)
                {
                    isFirstScrollEventVertical = true;
                }
            }

            Scroll(this, new ScrollEventArgs(type, oldValue, newValue, orientation));
        }
 public ScrollEventArgs(ScrollEventType type, int newValue, System.Windows.Forms.ScrollOrientation scroll)
 {
     this.oldValue = -1;
     this.type = type;
     this.newValue = newValue;
     this.scrollOrientation = scroll;
 }
Example #4
0
		public ScrollEventArgs (ScrollEventType type, int oldValue, int newValue, ScrollOrientation scroll)
		{
			this.new_value = newValue;
			this.old_value = oldValue;
			this.scroll_orientation = scroll;
			this.type = type;
		}
 public ScrollEventArgs(ScrollEventType type, int oldValue, int newValue)
 {
     this.oldValue = -1;
     this.type = type;
     this.newValue = newValue;
     this.oldValue = oldValue;
 }
Example #6
0
 public ScrollEventArgs(ScrollEventType type, int oldValue, int newValue)
 {
     throw null;
 }
Example #7
0
 private void RaiseScrollEvent(ScrollEventType scrollEventType)
 {
     if (this.Scroll == null)
         return;
     this.Scroll((object)this, new ScrollEventArgs(scrollEventType, this.Value));
 }
 public virtual void OnScroll(ScrollEventType type = ScrollEventType.ThumbPosition)
 {
     if (Scroll != null)
         Scroll(this, new ScrollEventArgs(type, Value, Orientation));
 }
        private void ScrollRows(int rowCount, int deltaY, ScrollEventType scrollEventType)
        {
            bool invalidateTopOfRowHeaders = false;
            Debug.Assert(rowCount != 0);
            Debug.Assert(deltaY != 0);
            Debug.Assert(this.displayedBandsInfo.FirstDisplayedScrollingRow >= this.Rows.GetRowCount(DataGridViewElementStates.Visible | DataGridViewElementStates.Frozen));
            this.verticalOffset -= deltaY;
            if (this.vertScrollBar.Enabled)
            {
                this.vertScrollBar.Value = this.verticalOffset;
            }
            ClearRegionCache();
            int frozenRowsThickness = this.Rows.GetRowsHeight(DataGridViewElementStates.Visible | DataGridViewElementStates.Frozen);
            Rectangle rowsRect = this.layout.Data;
            if (this.layout.RowHeadersVisible)
            {
                rowsRect = Rectangle.Union(rowsRect, this.layout.RowHeaders);
                if (this.SingleHorizontalBorderAdded)
                {
                    rowsRect.Y++;
                    rowsRect.Height--;
                    invalidateTopOfRowHeaders = true;
                }
            }
            else if (this.SingleVerticalBorderAdded)
            {
                Debug.Assert(rowsRect.X > 0);
                rowsRect.X--;
                rowsRect.Width++;
            }
            rowsRect.Y += frozenRowsThickness;
            rowsRect.Height -= frozenRowsThickness;
            Debug.Assert(rowsRect.Height >= 0);

            if (this.editingControl != null && 
                (this.Rows.GetRowState(this.ptCurrentCell.Y) & DataGridViewElementStates.Frozen) == 0)
            {
                Debug.Assert(this.displayedBandsInfo.FirstDisplayedScrollingRow > -1);
                PositionEditingControl(true /*setLocation*/, false /*setSize*/, false /*setFocus*/);
            }

            if (MouseButtons != MouseButtons.None)
            {
                this.dataGridViewState1[DATAGRIDVIEWSTATE1_scrolledSinceMouseDown] = true;
            }

            // The mouse probably is not over the same cell after the scroll.
            UpdateMouseEnteredCell(null /*HitTestInfo*/, null /*MouseEventArgs*/);

            NativeMethods.RECT scrollArea = NativeMethods.RECT.FromXYWH(rowsRect.X, rowsRect.Y, rowsRect.Width, rowsRect.Height);
            SafeNativeMethods.ScrollWindow(new HandleRef(this, this.Handle), 0, deltaY, ref scrollArea, ref scrollArea);
            if (invalidateTopOfRowHeaders)
            {
                rowsRect.X = this.layout.Inside.X;
                rowsRect.Y = this.layout.Inside.Y;
                rowsRect.Width = this.layout.RowHeaders.Width;
                rowsRect.Height = 1;
                Invalidate(rowsRect);
            }
            if (!this.dataGridViewState2[DATAGRIDVIEWSTATE2_stopRaisingVerticalScroll])
            {
                Debug.Assert(this.displayedBandsInfo.FirstDisplayedScrollingRow >= 0);
                int firstVisibleScrollingRow = this.Rows.GetFirstRow(DataGridViewElementStates.Visible, DataGridViewElementStates.Frozen);
                Debug.Assert(firstVisibleScrollingRow != -1);
                int newScrolledOffRowCount = this.Rows.GetRowCount(DataGridViewElementStates.Visible, firstVisibleScrollingRow, this.displayedBandsInfo.FirstDisplayedScrollingRow);
                Debug.Assert(newScrolledOffRowCount >= rowCount);
                OnScroll(scrollEventType, newScrolledOffRowCount - rowCount, newScrolledOffRowCount, ScrollOrientation.VerticalScroll);
            }
        }
        internal void ProcessVerticalScroll(ScrollEventType scrollEventType)
        {
            if (this._verticalScrollChangesIgnored > 0)
            {
                return;
            }
            Debug.Assert(DoubleUtil.LessThanOrClose(this._vScrollBar.Value, this._vScrollBar.Maximum));

            this._verticalScrollChangesIgnored++;
            try
            {
                Debug.Assert(this._vScrollBar != null);
                if (scrollEventType == ScrollEventType.SmallIncrement)
                {
                    this.DisplayData.PendingVerticalScrollHeight = GetVerticalSmallScrollIncrease();
                    double newVerticalOffset = this._verticalOffset + this.DisplayData.PendingVerticalScrollHeight;
                    if (newVerticalOffset > this._vScrollBar.Maximum)
                    {
                        this.DisplayData.PendingVerticalScrollHeight -= newVerticalOffset - this._vScrollBar.Maximum;
                    }
                }
                else if (scrollEventType == ScrollEventType.SmallDecrement)
                {
                    if (DoubleUtil.GreaterThan(this.NegVerticalOffset, 0))
                    {
                        this.DisplayData.PendingVerticalScrollHeight -= this.NegVerticalOffset;
                    }
                    else
                    {
                        int previousScrollingSlot = this.GetPreviousVisibleSlot(this.DisplayData.FirstScrollingSlot);
                        if (previousScrollingSlot >= 0)
                        {
                            ScrollSlotIntoView(previousScrollingSlot, false /*scrolledHorizontally*/);
                        }
                        return;
                    }
                }
                else
                {
                    this.DisplayData.PendingVerticalScrollHeight = this._vScrollBar.Value - this._verticalOffset;
                }

                if (!DoubleUtil.IsZero(this.DisplayData.PendingVerticalScrollHeight))
                {
                    // Invalidate so the scroll happens on idle
                    InvalidateRowsMeasure(false /*invalidateIndividualElements*/);
                }
                // 
            }
            finally
            {
                this._verticalScrollChangesIgnored--;
            }
        }
Example #11
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Scroll vertical
        /// </summary>
        /// <param name="type"></param>
        /// ------------------------------------------------------------------------------------
        public void VerticalScroll(ScrollEventType type)
        {
            CheckDisposed();

            Win32.PostMessage(Handle, Win32.WinMsgs.WM_VSCROLL, (int)type, 0);
        }
Example #12
0
        internal void DoScroll(int newValue, ScrollEventType eventType)
        {
            int oldValue = this.Value;
            this.Value = newValue;
#if FRAMEWORK20
            OnScroll(new ScrollEventArgs(eventType, oldValue, newValue, _ScrollBar.Orientation == eOrientation.Vertical ? ScrollOrientation.VerticalScroll : ScrollOrientation.HorizontalScroll));
#else
            OnScroll(new ScrollEventArgs(eventType, newValue));
#endif
        }
Example #13
0
        void OnClickOnSmallOrLargeDecreaseIncreaseButtons(double amountByWhichToIncreaseOrDecreaseTheValue, ScrollEventType scrollEventType)
        {
            double newValue = CoerceValue(this.Value + amountByWhichToIncreaseOrDecreaseTheValue);

            if (newValue != this.Value)
            {
                this.SetLocalValue(RangeBase.ValueProperty, newValue); // Note: we do not use "this.Value = newValue" because it deletes any bindings that the user may have set to the scrollbar with <ScrollBar Value="{Binding...}"/>.
                if (this.Scroll != null)
                {
                    this.Scroll(this, new ScrollEventArgs(newValue, scrollEventType));
                }
            }

            if (Orientation == Orientation.Horizontal)
            {
                _horizontalThumb.Focus();
            }
            else
            {
                _verticalThumb.Focus();
            }
        }
 public ScrollEventArgs(ScrollEventType type, int newValue, ScrollOrientation scroll)
 {
     _scrollType        = type;
     NewValue           = newValue;
     _scrollOrientation = scroll;
 }
 public ScrollEventArgs(ScrollEventType type, int oldValue, int newValue)
 {
     _scrollType = type;
     _oldValue   = oldValue;
     NewValue    = newValue;
 }
Example #16
0
 /// <summary>
 ///  Initializes a new instance of the <see cref="ScrollEventArgs"/> class.
 /// </summary>
 public ScrollEventArgs(ScrollEventType type, int newValue)
 {
     Type     = type;
     NewValue = newValue;
     OldValue = -1;
 }
Example #17
0
 public ScrollEventArgs(ScrollEventType type, int oldValue, int newValue, ScrollOrientation scroll)
 {
     throw null;
 }
Example #18
0
        /// <include file='doc\ScrollBar.uex' path='docs/doc[@for="ScrollBar.DoScroll"]/*' />
        /// <devdoc>
        /// </devdoc>
        /// <internalonly/>
        private void DoScroll(ScrollEventType type) {

            // For Rtl systems we need to swap increment and decrement
            //
            if (RightToLeft == RightToLeft.Yes) {
                switch (type) {
                    case ScrollEventType.First:
                        type = ScrollEventType.Last;
                        break;

                    case ScrollEventType.Last:
                        type = ScrollEventType.First;
                        break;

                    case ScrollEventType.SmallDecrement:
                        type = ScrollEventType.SmallIncrement;
                        break;

                    case ScrollEventType.SmallIncrement:
                        type = ScrollEventType.SmallDecrement;
                        break;

                    case ScrollEventType.LargeDecrement:
                        type = ScrollEventType.LargeIncrement;
                        break;

                    case ScrollEventType.LargeIncrement:
                        type = ScrollEventType.LargeDecrement;
                        break;
                }
            }
            
            int newValue = value;
            int oldValue = value;

            // The ScrollEventArgs constants are defined in terms of the windows
            // messages..  this eliminates confusion between the VSCROLL and
            // HSCROLL constants, which are identical.
            //
            switch (type) {
                case ScrollEventType.First:
                    newValue = minimum;
                    break;

                case ScrollEventType.Last:
                    newValue = maximum - LargeChange + 1; // si.nMax - si.nPage + 1;
                    break;

                case ScrollEventType.SmallDecrement:
                    newValue = Math.Max(value - SmallChange, minimum);
                    break;

                case ScrollEventType.SmallIncrement:
                    newValue = Math.Min(value + SmallChange, maximum - LargeChange + 1); // max - lChange + 1);
                    break;

                case ScrollEventType.LargeDecrement:
                    newValue = Math.Max(value - LargeChange, minimum);
                    break;

                case ScrollEventType.LargeIncrement:
                    newValue = Math.Min(value + LargeChange, maximum - LargeChange + 1); // si.nPos + si.nPage,si.nMax - si.nPage + 1);
                    break;

                case ScrollEventType.ThumbPosition:
                case ScrollEventType.ThumbTrack:
                    NativeMethods.SCROLLINFO si = new NativeMethods.SCROLLINFO();
                    si.fMask = NativeMethods.SIF_TRACKPOS;
                    SafeNativeMethods.GetScrollInfo(new HandleRef(this, Handle), NativeMethods.SB_CTL, si);
                    
                    if (RightToLeft == RightToLeft.Yes) {
                        newValue = ReflectPosition(si.nTrackPos);
                    }
                    else {
                        newValue = si.nTrackPos;
                    }
                    
                    break;
            }

            ScrollEventArgs se = new ScrollEventArgs(type, oldValue, newValue, this.scrollOrientation);
            OnScroll(se);
            Value = se.NewValue;
        }
Example #19
0
 /// <summary>
 /// Raises the <see cref="Scroll"/> event.
 /// </summary>
 /// <param name="type">The scroll event type.</param>
 protected internal void RaiseScrollEvent(ScrollEventType type)
 {
     var evtData = RoutedEventData.Retrieve(this);
     var evtDelegate = EventManager.GetInvocationDelegate<UpfScrollEventHandler>(ScrollEvent);
     evtDelegate(this, type, evtData);
 }
Example #20
0
 public ScrollEventArgs(ScrollEventType eventType, double newValue)
 {
     ScrollEventType = eventType;
     NewValue        = newValue;
 }
 private void OnScroll(ScrollEventType scrollType, int newValue)
 {
     var ev = Scroll;
     if (ev != null) ev(this, new ScrollEventArgs(scrollType, newValue));
 }
Example #22
0
 protected void OnScroll(ScrollEventType scrollEventType)
 {
     Scroll?.Invoke(this, new ScrollEventArgs(scrollEventType, Value));
 }
        internal void ProcessHorizontalScroll(ScrollEventType scrollEventType)
        {
            if (this._horizontalScrollChangesIgnored > 0)
            {
                return;
            }

            // If the user scrolls with the buttons, we need to update the new value of the scroll bar since we delay
            // this calculation.  If they scroll in another other way, the scroll bar's correct value has already been set
            double scrollBarValueDifference = 0;
            if (scrollEventType == ScrollEventType.SmallIncrement)
            {
                scrollBarValueDifference = GetHorizontalSmallScrollIncrease();
            }
            else if (scrollEventType == ScrollEventType.SmallDecrement)
            {
                scrollBarValueDifference = -GetHorizontalSmallScrollDecrease();
            }
            this._horizontalScrollChangesIgnored++;
            try
            {
                if (scrollBarValueDifference != 0)
                {
                    Debug.Assert(this._horizontalOffset + scrollBarValueDifference >= 0);
                    this._hScrollBar.Value = this._horizontalOffset + scrollBarValueDifference;
                }
                UpdateHorizontalOffset(this._hScrollBar.Value);
            }
            finally
            {
                this._horizontalScrollChangesIgnored--;
            }

            DataGridAutomationPeer peer = DataGridAutomationPeer.FromElement(this) as DataGridAutomationPeer;
            if (peer != null)
            {
                peer.RaiseAutomationScrollEvents();
            }
        }
Example #24
0
 public ScrollEventArgs(ScrollEventType type, int newValue, ScrollOrientation scroll)
 {
     this.type              = type;
     this.newValue          = newValue;
     this.scrollOrientation = scroll;
 }
 private void OnScroll(ScrollEventType scrollEventType, int oldValue, int newValue, ScrollOrientation orientation)
 {
     ScrollEventArgs se = new ScrollEventArgs(scrollEventType, oldValue, newValue, orientation);
     OnScroll(se);
     RefreshByCurrentPos(oldValue, newValue);
     if (ScrollOrientation.VerticalScroll == orientation)
     {
         if (se.NewValue != newValue)
         {
             try
             {
                 this.dataGridViewState2[DATAGRIDVIEWSTATE2_stopRaisingVerticalScroll] = true;
                 int rowIndex = this.Rows.GetFirstRow(DataGridViewElementStates.Visible, DataGridViewElementStates.Frozen);
                 int rowIndexPrevious = rowIndex;
                 newValue = se.NewValue;
                 while (rowIndex != -1 && newValue > 0)
                 {
                     rowIndexPrevious = rowIndex;
                     rowIndex = this.Rows.GetNextRow(rowIndex, DataGridViewElementStates.Visible);
                     newValue--;
                 }
                 if (rowIndex != -1)
                 {
                     rowIndexPrevious = rowIndex;
                 }
                 if (rowIndexPrevious != -1)
                 {
                     this.FirstDisplayedScrollingRowIndex = rowIndexPrevious;
                 }
             }
             finally
             {
                 this.dataGridViewState2[DATAGRIDVIEWSTATE2_stopRaisingVerticalScroll] = false;
             }
         }
     }
     else
     {
         if (se.NewValue != newValue)
         {
             try
             {
                 this.dataGridViewState2[DATAGRIDVIEWSTATE2_stopRaisingHorizontalScroll] = true;
                 this.HorizontalOffset = se.NewValue;
             }
             finally
             {
                 this.dataGridViewState2[DATAGRIDVIEWSTATE2_stopRaisingHorizontalScroll] = false;
             }
         }
     }
 }
Example #26
0
 public ScrollEventArgs(ScrollEventType type, int oldValue, int newValue)
 {
     this.type     = type;
     this.newValue = newValue;
     this.oldValue = oldValue;
 }
        private void ScrollRowsByCount(int rows, ScrollEventType scrollEventType) 
        {
            Debug.Assert(rows != 0);
            Debug.Assert((rows > 0 && (scrollEventType == ScrollEventType.SmallIncrement || scrollEventType == ScrollEventType.LargeIncrement)) ||
                         (rows < 0 && (scrollEventType == ScrollEventType.SmallDecrement || scrollEventType == ScrollEventType.LargeDecrement)));

            int deltaY = 0;
            Debug.Assert(this.displayedBandsInfo.FirstDisplayedScrollingRow >= 0);
            int newFirstVisibleScrollingRow = this.displayedBandsInfo.FirstDisplayedScrollingRow;
            if (rows > 0)
            {
                for (int rowCount = rows; rowCount > 0; rowCount--)
                {
                    deltaY -= this.Rows.SharedRow(newFirstVisibleScrollingRow).GetHeight(newFirstVisibleScrollingRow);
                    newFirstVisibleScrollingRow = this.Rows.GetNextRow(newFirstVisibleScrollingRow,
                        DataGridViewElementStates.Visible);

                    Debug.Assert(newFirstVisibleScrollingRow != -1);
                }
                if (newFirstVisibleScrollingRow != -1)
                {
                    int oldFirstVisibleScrollingRow = this.displayedBandsInfo.FirstDisplayedScrollingRow;
                    // Tentative target value for this.displayedBandsInfo.FirstDisplayedScrollingRow.
                    this.displayedBandsInfo.FirstDisplayedScrollingRow = newFirstVisibleScrollingRow;
                    // This sets the actual value of this.displayedBandsInfo.FirstDisplayedScrollingRow
                    ComputeVisibleRows();
                    // Compute the actual deltaY given the new this.displayedBandsInfo.FirstDisplayedScrollingRow
                    if (this.displayedBandsInfo.FirstDisplayedScrollingRow > oldFirstVisibleScrollingRow)
                    {
                        deltaY = -this.Rows.GetRowsHeight(DataGridViewElementStates.Visible, oldFirstVisibleScrollingRow, this.displayedBandsInfo.FirstDisplayedScrollingRow);
                        rows = this.Rows.GetRowCount(DataGridViewElementStates.Visible, oldFirstVisibleScrollingRow, this.displayedBandsInfo.FirstDisplayedScrollingRow);
                    }
                    else
                    {
                        Debug.Assert(this.displayedBandsInfo.FirstDisplayedScrollingRow == oldFirstVisibleScrollingRow);
                        rows = 0;
                    }
                }
            }
            else
            {
                for (int rowCount = rows; rowCount < 0; rowCount++)
                {
                    newFirstVisibleScrollingRow = this.Rows.GetPreviousRow(newFirstVisibleScrollingRow,
                        DataGridViewElementStates.Visible,
                        DataGridViewElementStates.Frozen);
                    if (newFirstVisibleScrollingRow != -1)
                    {
                        deltaY += this.Rows.SharedRow(newFirstVisibleScrollingRow).GetHeight(newFirstVisibleScrollingRow);
                    }
                }
                if (newFirstVisibleScrollingRow != -1)
                {
                    this.displayedBandsInfo.FirstDisplayedScrollingRow = newFirstVisibleScrollingRow;
                    ComputeVisibleRows();
                    Debug.Assert(this.displayedBandsInfo.FirstDisplayedScrollingRow == newFirstVisibleScrollingRow);
                }
            }

            if (newFirstVisibleScrollingRow != -1 && rows != 0)
            {
                ScrollRows(rows, deltaY, scrollEventType);
            }

            FlushDisplayedChanged();
        }
 public ScrollEvent(int viewTag, ScrollEventType type, JObject data)
     : base(viewTag)
 {
     _type = type;
     _data = data;
 }
	// Generate the events when the scrollbar is incremented or decremented
	private void GenerateManualScrollEvents(int newValue, ScrollEventType type)
	{
		ScrollEventArgs se = new ScrollEventArgs(type, newValue);
		OnScroll(se);
		// This should be checked. If the value is set back to the previous value, I assume
		// this prevents an OnValueChanged event.
		if (se.NewValue != value)
		{
			value = se.NewValue;
			LayoutScrollBar();
			OnValueChanged(new EventArgs());
		}
	}
Example #30
0
		public ScrollEventArgs (ScrollEventType type, int oldValue, int newValue) :
			this (type, oldValue, newValue, ScrollOrientation.HorizontalScroll)
		{
		}
Example #31
0
        private void ScroolToPosition(ScrollEventType scrollEventType, int newValue)
        {
            if (newValue == this.VertScrollBar.Value ||
                newValue <= this.VertScrollBar.Minimum || this.VertScrollBar.Maximum <= newValue)
                return;

            this.VertScrollBar.Value = newValue;
            ScrollEventArgs scrollEventArgs = new ScrollEventArgs(scrollEventType, this.VertScrollBar.Value, newValue);
            this.HandleScroll(this, scrollEventArgs);
        }
Example #32
0
 public MonitorScrollEventArgs(Display monitor, ScrollEventType type, int oldValue, int newValue, ScrollOrientation scroll)
     : base(type, oldValue, newValue, scroll)
 {
     this.monitor = monitor;
 }
Example #33
0
		public ScrollEventArgs (ScrollEventType type, int newValue, ScrollOrientation scroll) :
			this (type, -1, newValue, scroll)
		{
		}
		public void performScrollVertical(ScrollEventType type)
		{
			int param = getSBFromScrollEventType(type);
			if (param == -1)
				return;
			SendMessage(this.Handle, (uint)WM_VSCROLL, (System.UIntPtr)param, (System.IntPtr)0);	
		}
        /// <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 #36
0
        private void SetValue(int value, ScrollEventType type)
        {
            value = NormalizeValue(value);
#if FRAMEWORK20
            OnScroll(new ScrollEventArgs(type, m_Value, value, this.ScrollOrientation));
#else
			OnScroll(new ScrollEventArgs(type, value));
#endif
            Value = value;
            _RaiseEndScroll = true;
        }
Example #37
0
        /// <summary> 
        /// This raises the Scroll event, passing in the scrollEventType 
        /// as a parameter to let the handler know what triggered this event.
        /// </summary> 
        /// <param name="scrollEventType">ScrollEventType</param>
        internal void RaiseScrollEvent(ScrollEventType scrollEventType) 
        {
            ScrollEventArgs newEvent = new ScrollEventArgs(scrollEventType, Value);
 
            if (Scroll != null) 
            {
                Scroll(this, newEvent); 
            }
        }
Example #38
0
        private void DoScroll(ScrollEventType type)
        {
            int newValue = value;
            int oldValue = value;

            switch (type)
            {
                case ScrollEventType.First:
                    newValue = minimum;
                    break;

                case ScrollEventType.Last:
                    newValue = maximum - LargeChange + 1;
                    break;

                case ScrollEventType.SmallDecrement:
                    newValue = Math.Max(value - SmallChange, minimum);
                    break;

                case ScrollEventType.SmallIncrement:
                    newValue = Math.Min(value + SmallChange, maximum - LargeChange + 1);
                    break;

                case ScrollEventType.LargeDecrement:
                    newValue = Math.Max(value - LargeChange, minimum);
                    break;

                case ScrollEventType.LargeIncrement:
                    newValue = Math.Min(value + LargeChange, maximum - LargeChange + 1);
                    break;

                case ScrollEventType.ThumbPosition:
                case ScrollEventType.ThumbTrack:

                    Application.Log("not implemented yet");
                    break;
            }

            UpdateScrollRect();

            ScrollEventArgs se = new ScrollEventArgs(type, oldValue, newValue, this.scrollOrientation);
            OnScroll(se);
            Value = se.NewValue;
        }
Example #39
0
 /// <summary>
 /// This is an instance constructor for the ScrollEventArgs class.  It
 /// is constructed with a reference to the event being raised.
 /// </summary>
 /// <returns>Nothing.</returns>
 public ScrollEventArgs(ScrollEventType scrollEventType, double newValue) : base()
 {
     _scrollEventType = scrollEventType;
     _newValue = newValue;
     RoutedEvent =ScrollBar.ScrollEvent;
 }
 public ScrollEventArgs(ScrollEventType scrollEventType, double newValue)
 {
 }
Example #41
0
 private void RaiseScrollEvent(ScrollEventType scrollEventType)
 {
     RaiseEvent(new ScrollEventArgs(ScrollEvent, this, scrollEventType, Value));
 }
        private void SetValue(int newValue, ScrollEventType type)
        {
            //FieldInfo fi = typeof(System.Windows.Forms.ScrollBar).GetField("value", BindingFlags.NonPublic | BindingFlags.Instance);
            //if (fi != null)
            //{
            //    fi.SetValue(this, newValue);
            //    UpdateSystemScrollInfo();
            //}
            //else

            if (m_ParentScrollBar.Value == newValue) return;

            if (m_UseLockWindowUpdate && m_ParentScrollBar.Parent != null)
                NativeFunctions.LockWindowUpdate(m_ParentScrollBar.Parent.Handle);
            else
                NativeFunctions.SendMessage(m_ParentScrollBar.Handle, NativeFunctions.WM_SETREDRAW, 0, 0);

            m_ParentScrollBarWndProc.SetValue(newValue, type);
            if (m_UseLockWindowUpdate && m_ParentScrollBar.Parent != null)
                NativeFunctions.LockWindowUpdate(IntPtr.Zero);
            else
                NativeFunctions.SendMessage(m_ParentScrollBar.Handle, NativeFunctions.WM_SETREDRAW, 1, 0);

            if (m_ParentScrollBar.Parent is DataGridView && type == ScrollEventType.ThumbTrack)
            {
                if (m_UseLockWindowUpdate)
                    m_ParentScrollBar.Parent.Refresh();
                else
                {
                    Point p = m_ParentScrollBar.PointToClient(Control.MousePosition);
                    if (!m_ParentScrollBar.ClientRectangle.Contains(p)) 
                        m_ParentScrollBar.Parent.Refresh();
                }
            }

            PaintUsingDC();
        }
 private void OnScroll(ScrollEventType scrollType, int newValue)
 {
     if (Scroll != null)
         Scroll(this, new ScrollEventArgs(scrollType, newValue));
 }
 /// <summary>
 /// This is an instance constructor for the ScrollEventArgs class.  It
 /// is constructed with a reference to the event being raised.
 /// </summary>
 /// <returns>Nothing.</returns>
 public ScrollEventArgs(ScrollEventType scrollEventType, double newValue) : base()
 {
     _scrollEventType = scrollEventType;
     _newValue        = newValue;
     RoutedEvent      = ScrollBar.ScrollEvent;
 }