Time for action – scroll bars
Double click on the
MapEditor.vb
file in Solution Explorer to reopen the map editor in the design view if it is not already open.In the Toolbox window, double-click on the
VScrollBar
control, to add it to the form. Give it the following properties:Name:
VScrollBar1
Anchor:
Top
,Bottom
,Right
LargeChange:
48
Location:
658
,27
Size:
17
,576
In the Toolbox window, double-click on the
HScrollBar
control to add it to the form. Give it the following properties:Name:
HScrollBar1
Anchor:
Bottom
,Left
,Right
LargeChange:
48
Location:
184
,606
Size:
474
,17
Switch back to the code view for the
MapEditor.vb
file, and add theFixScrollBarScales()
helper method to theMapEditor
class:Private Sub FixScrollBarScales() Camera.ViewPortWidth = pctSurface.Width Camera.ViewPortHeight = pctSurface.Height Camera.Move(Vector2.Zero) VScrollBar1.Minimum = 0 VScrollBar1.Maximum =Camera.WorldRectangle.Height -Camera.ViewPortHeight HScrollBar1.Minimum = 0 HScrollBar1.Maximum = Camera...