tags:

views:

32

answers:

2

I'm tinkering with writing a simple text-based role-playing game. I would like to use WinForms, and utilize WinForm controls for the UI and simple text for the output. The catch is, I would like to have complete control over the formatting of the individual text - some words being different colors, etc. A simple console control would suffice, as that would provide control over text colors, but it would be nice to also be able to change style, font and size.

Less important: it would be nice to have complete control over where text appears in the control through a coordinate system, as with DOS windows of old.

I'd appreciate suggestions on the best method of implementing this. Perhaps there is a better method I had not considered for rendering the output of a text-based game.

+3  A: 

Hmm... maybe you could use or adapt a RichTextBox or a WebBrowser control for this purpose?

stakx
+1 WebBrowser might give the best freedom imo
Mikael Svenson
Both sound like workable options. Is there any overhead from having an excessive amount of HTML markup in a scrollable WebBrowser window? One additional factor would be that the WB window would offer the ability of hyper linking within the text. Thanks!
Rich.Carpenter
In my experience, web browsers *generally* handle large pages quite well in cases where they contain mostly text. Rendering might become significantly slower once you introduce more complex elements such as tables and images into the displayed page. I think you'll be fine for mostly text-based information.
stakx
+1  A: 

You have complete control by overriding the OnPaint() method. Use TextRenderer.DrawText() to get it exactly the way you want it.

Hans Passant