private void ResetHorizontalScrollbar() { BoxArrowDiagram d = this.GetFlowDiagram(); float zoom = d.Zoom; float diagwid = d.WorkspaceRectangle.Width * zoom; float clientwid = d.ClientSize.Width; int Extra = Convert.ToInt32(30 * zoom); if (clientwid >= diagwid) { this.ScrollBarHorizontal.Enabled = false; this.ScrollBarHorizontal.Value = 0; d.HorizontalScrollValue = 0; } else { this.ScrollBarHorizontal.Enabled = true; this.ScrollBarHorizontal.Minimum = 0; this.ScrollBarHorizontal.Maximum = Convert.ToInt32(diagwid - clientwid + Extra); this.ScrollBarHorizontal.SmallChange = Convert.ToInt32(d.CellSize * zoom); this.ScrollBarHorizontal.LargeChange = Convert.ToInt32(d.CellSize * zoom); if (this.ScrollBarHorizontal.SmallChange == 0) { this.ScrollBarHorizontal.SmallChange = 1; } if (this.ScrollBarHorizontal.LargeChange == 0) { this.ScrollBarHorizontal.LargeChange = 1; } this.ScrollBarHorizontal.Maximum += Convert.ToInt32(this.ScrollBarHorizontal.LargeChange); if (d.HorizontalScrollValue <= ScrollBarHorizontal.Maximum) { d.HorizontalScrollValue = d.HorizontalScrollValue; } } }
private void ResetVerticalScrollbar() { BoxArrowDiagram d = this.GetFlowDiagram(); float zoom = d.Zoom; float diaghgt = d.WorkspaceRectangle.Height * zoom; float clienthgt = d.ClientSize.Height; int Extra = Convert.ToInt32(30 * zoom); if (clienthgt >= diaghgt) { this.ScrollBarVertical.Enabled = false; this.ScrollBarVertical.Value = 0; d.VerticalScrollValue = 0; } else { this.ScrollBarVertical.Enabled = true; this.ScrollBarVertical.Minimum = 0; this.ScrollBarVertical.Maximum = Convert.ToInt32(diaghgt - clienthgt + Extra); this.ScrollBarVertical.SmallChange = Convert.ToInt32(d.CellSize * zoom); this.ScrollBarVertical.LargeChange = Convert.ToInt32(d.CellSize * zoom); if (this.ScrollBarVertical.SmallChange == 0) { this.ScrollBarVertical.SmallChange = 1; } if (this.ScrollBarVertical.LargeChange == 0) { this.ScrollBarVertical.LargeChange = 1; } this.ScrollBarVertical.Maximum += Convert.ToInt32(this.ScrollBarVertical.LargeChange); if (d.VerticalScrollValue <= ScrollBarVertical.Maximum) { d.VerticalScrollValue = d.VerticalScrollValue; } } }