Domanda

Searching the internet for none console based text, read only, solutions has come up empty handed. I want to take from a text file and make it show on screen. I also want to learn how to use a scroll bar to scroll through the text if its to long (Y axis). If some one know were to direct me to learn about this or has an answer to the problem that I am having, I would be great full of your help.

I am using Microsoft visual C# 2010, XNA Windows Game (4.0) template.

È stato utile?

Soluzione

As I commented, you should use a TextBox. You should set the property Multiline to true, and ScrollBars to ScrollBars.Vertical.

For reading the text file, use the following line:

System.IO.File.ReadAllText(textFileLocation)

This will return a String with the contents of the file.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top