When you play the game, you probably noticed the messages RichTextBox scrolls to the top after you add more messages to it. So, the player has to manually scroll to the bottom to see the latest message.
We want to make it easier for the player.
How to scroll to the bottom of a RichTextBox
Step 1: Add this new ScrollToBottomOfMessages() function to the code in the SuperAdventure.cs class:
private void ScrollToBottomOfMessages()
rtbMessages.SelectionStart = rtbMessages.Text.Length;
Step 2: After you add more to rtbMessages.Text, call the ScrollToBottomOfMessages() method.
Source code for this lesson
Next lesson: Lesson 19.2 – Use a calculated value for a property
Previous lesson: Lesson 18.1 – Future enhancements for the game
All lessons: Learn C# by Building a Simple RPG Index