문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top