.net - Console-like text control? -
i'm looking winforms control can output text in console window (output appended bottom, color formatting, etc.) "output" window in ides.
i tried making 1 myself didn't work way wanted, i'm wondering if there existing control out there.
this open-source project.
i have wrote simple control. not work colors (its derived textwriter, not support colors).
internal class textboxwriter : textwriter { textbox _output; public textboxwriter(textbox output) { _output = output; } public override void writeline(string value) { write(value + system.console.out.newline); } public override void write(string value) { if(_output.invokerequired) { _output.begininvoke((action<string>)write, value); } else { _output.appendtext(value); } } public override void write(char value) { write(value.tostring()); } public override encoding encoding { { return encoding.utf8; } } }
usage:
//designer code private system.windows.forms.textbox outputtextbox; this.outputtextbox = new system.windows.forms.textbox(); //user code var _textwriter = new textboxwriter(); system.console.setout(_textwriter); console.writeline("hello"); //this show in outputtextbox
Comments
Post a Comment