System.Windows.Forms.ScrollableControl.ScrollControlIntoView C# (CSharp) Method

ScrollControlIntoView() public method

public ScrollControlIntoView ( Control activeControl ) : void
activeControl Control
return void
		public void ScrollControlIntoView (Control activeControl)
		{
			int corner_x;
			int corner_y;
			
			Rectangle within = new Rectangle ();
			within.Size = ClientSize;
			
			if (!AutoScroll || (!m_helper.HasHorizontalRuler && !m_helper.HasVerticalRuler)) {
				return;
			}
			
			if (!Contains (activeControl)) {
				return;
			}
			
			m_helper.ScrollRectToVisible (new RectangleF (activeControl.Location, activeControl.Size));
		}

Usage Example

        private void ScrollActiveControlIntoView()
        {
            Control last = activeControl;

            if (last != null)
            {
                ScrollableControl scrollParent = FindScrollableParent(last);

                while (scrollParent != null)
                {
                    scrollParent.ScrollControlIntoView(activeControl);
                    last         = scrollParent;
                    scrollParent = FindScrollableParent(scrollParent);
                }
            }
        }
All Usage Examples Of System.Windows.Forms.ScrollableControl::ScrollControlIntoView