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

ScrollWindow() private method

private ScrollWindow ( int XOffset, int YOffset ) : void
XOffset int
YOffset int
return void
		private void ScrollWindow (int XOffset, int YOffset)
		{
			int num_of_children;
			
			if (XOffset == 0 && YOffset == 0) {
				return;
			}
			
			SuspendLayout ();
			
			num_of_children = Controls.Count;
			
			for (int i = 0; i < num_of_children; i++) {
				Controls[i].Location = new Point (Controls[i].Left - XOffset, Controls[i].Top - YOffset);
				//Controls[i].Left -= XOffset;
				//Controls[i].Top -= YOffset;
				// Is this faster? Controls[i].Location -= new Size(XOffset, YOffset);
			}
			
			scroll_position.X += XOffset;
			scroll_position.Y += YOffset;
			var rect = ClientRectangle;
			rect.Location = new Point (XOffset, YOffset);
			m_helper.ScrollRectToVisible (rect);
			ResumeLayout (false);
		}
		#endregion