Time for action – scroll bars

  1. In the Toolbox window, double-click on the VScrollBar control to add it to the form. Give it the following properties:
    1. Name : vScrollBar1
    2. Anchor : Top, Bottom, Right
    3. LargeChange : 48
    4. Location : 658, 27
    5. Size : 17, 576
  2. In the Toolbox window, double-click on the HScrollBar control to add it to the form. Give it the following properties:
    1. Name : hScrollBar1
    2. Anchor : Bottom, Left, Right
    3. LargeChange : 48
    4. Location : 184, 606
    5. Size : 474, 17
  3. Add the FixScrollBarScales() helper method to the MapEditor class:
    private void FixScrollBarScales() { Camera.ViewPortWidth = pctSurface.Width; Camera.ViewPortHeight = pctSurface.Height; Camera.Move(Vector2.Zero); vScrollBar1.Minimum = 0; vScrollBar1.Maximum = Camera.WorldRectangle.Height - Camera.ViewPortHeight; ...

Get XNA 4.0 Game Development by Example Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.