Rich.Carpenter
Rich.Carpenter

Reputation: 1066

Console-like control that allows full control over individual text formatting

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.

Upvotes: 2

Views: 647

Answers (2)

Hans Passant
Hans Passant

Reputation: 942080

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

Upvotes: 1

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

Upvotes: 3

Related Questions