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; XplatUI.ScrollWindow(Handle, ClientRectangle, -XOffset, -YOffset, false); ResumeLayout(false); }
private void HScrollBarValueChanged(object sender, EventArgs e) { int pixels; if (hbar.Value > hbar_value) { pixels = -1 * (hbar.Value - hbar_value); } else { pixels = hbar_value - hbar.Value; } hbar_value = hbar.Value; XplatUI.ScrollWindow(Handle, ViewPort, pixels, 0, false); }
private void VScrollBarValueChanged(object sender, EventArgs e) { int pixels; if (vbar.Value > vbar_value) { pixels = -1 * (vbar.Value - vbar_value); } else { pixels = vbar_value - vbar.Value; } vbar_value = vbar.Value; XplatUI.ScrollWindow(Handle, ViewPort, 0, pixels, false); }