Sign in to follow this  
kustom

[.net] Writing text in a .NET Form

Recommended Posts

kustom    122
Hello to all, i have just coded a window with .NET with C++/CLI, i want to do a window lika a console (with input and output), how can i write text inside a window form? thanks in advance Kustom

Share this post


Link to post
Share on other sites
RizMan    146
You cannot write text onto the form itself. Instead, just place a label onto the form and set its Text property to whataever you whish. You can set the labels background color, font-color etc...properties to reflect a similar look as a console.

For text input place a TextBox control on your form

Share this post


Link to post
Share on other sites
Machaira    1033
You can write text directly onto a form using the Graphics class:

Graphics gr = this.CreateGraphics();

gr.DrawString("This is a test",this.Font,Brushes.Blue, new Rectangle(10,10,100,25));

Share this post


Link to post
Share on other sites
kustom    122
hi again,

Machaira: i tried to do it and worked, but i need user can "select" the text...
Writing in a Graphic from a Form is like a bitmap...

Rizman: i will try to do it, thanks

kind regards

Kustom

Share this post


Link to post
Share on other sites
Rob Loach    1504
What's wrong with using the Console itself? If you really want to use a form, you could anchor a textbox over it so that it looks like a console screen. It's very easy to change the font and background color of the textbox.

Share this post


Link to post
Share on other sites
kustom    122
hi Rob Loach,

sorry for my ignorance, i dont knew the Console class from .NET Framework, i think this class can save lot of job instead of doing my own console.

thanks

Ruben

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this