/// <summary>Set ScrollBar increments and bounds from map dimensions.</summary> public virtual void SetScrollLimits(IMapDisplayWinForms model) { if (model == null) { return; } var smallChange = Size.Ceiling(model.GridSize.Scale(MapScale)); HorizontalScroll.SmallChange = smallChange.Width; VerticalScroll.SmallChange = smallChange.Height; var largeChange = Size.Round(ClientSize.Scale(0.75F)); HorizontalScroll.LargeChange = Math.Max(largeChange.Width, smallChange.Width); VerticalScroll.LargeChange = Math.Max(largeChange.Height, smallChange.Height); var size = Hexgrid.GetSize(MapSizePixels, MapScale); if (AutoScrollMinSize != size) { AutoScrollMinSize = size; HorizontalScroll.Maximum = Math.Min(1, Math.Max(1, Padding.Left + Padding.Right + size.Width - ClientSize.Width)); VerticalScroll.Maximum = Math.Min(1, Math.Max(1, Padding.Top + Padding.Bottom + size.Height - ClientSize.Height)); Invalidate(); } }
/// <summary>Set ScrollBar increments and bounds from map dimensions.</summary> public virtual void SetScrollLimits(IMapDisplay model) { if (model == null || !AutoScroll) { return; } var smallChange = Size.Ceiling(model.GridSize.Scale(MapScale)); HorizontalScroll.SmallChange = smallChange.Width; VerticalScroll.SmallChange = smallChange.Height; var largeChange = Size.Round(ClientSize.Scale(0.75F)); HorizontalScroll.LargeChange = Math.Max(largeChange.Width, smallChange.Width); VerticalScroll.LargeChange = Math.Max(largeChange.Height, smallChange.Height); var size = DataContext.Hexgrid.GetSize(MapSizePixels, MapScale) + Margin.Size; if (AutoScrollMinSize != size) { AutoScrollMinSize = size; HorizontalScroll.Maximum = Math.Min(1, Math.Max(1, Margin.Horizontal + size.Width - ClientSize.Width)); VerticalScroll.Maximum = Math.Min(1, Math.Max(1, Margin.Vertical + size.Height - ClientSize.Height)); Invalidate(); } }
/// <summary>Set ScrollBar increments and bounds from map dimensions.</summary> public virtual void SetScroll() { var smallChange = Size.Ceiling(Host.GridSize.Scale(MapScale)); HorizontalScroll.SmallChange = smallChange.Width; VerticalScroll.SmallChange = smallChange.Height; var largeChange = Size.Round(ClientSize.Scale(0.75F)); HorizontalScroll.LargeChange = Math.Max(largeChange.Width, smallChange.Width); VerticalScroll.LargeChange = Math.Max(largeChange.Height, smallChange.Height); var size = TransposeSize(Size.Ceiling(MapSizePixels.Scale(MapScale))); if (AutoScrollMinSize != size) { AutoScrollMinSize = size; HorizontalScroll.Maximum = Math.Min(1, Math.Max(1, size.Width - ClientSize.Width)); VerticalScroll.Maximum = Math.Min(1, Math.Max(1, size.Height - ClientSize.Height)); Invalidate(); } }