Hi,
Just say I´d like this string:
Added to a label;Code:string text = "Hello my friend";
Now say, I´d like to format part of the string, bold.Code:label1.text = text;
How can I go about doing this? This is C# Winforms.
Thanks!.
Printable View
Hi,
Just say I´d like this string:
Added to a label;Code:string text = "Hello my friend";
Now say, I´d like to format part of the string, bold.Code:label1.text = text;
How can I go about doing this? This is C# Winforms.
Thanks!.
Hi, I´d also like to know how to add or append a string to the lable, with a certain indentation, or padding,...
Thanks,..!
for the margin I´ve added:
"\t" + "Some text", but It doesn´t like it either,..
The Label doesnt support formatting parts of the text, you can either make all the text bold or none of it.
And to append text to a label:
C# Code:
Label1.Text += "hello";
Hi, thanks for the reply,
How can I make all of it bold from code?
For instance:
HOw would you make text bold?Code:String text = "Hello";
Label1.Text += text;
C# Code:
label1.Font = new Font(label1.Font, FontStyle.Bold);
Also i would watch using words like Text i don't believe it is a reserved word in C# but some words are.
Thanks Atheist,Hell-Lord,
I still find it quite annoying that I can´t format part of the text bold, and parts of the text with an indentation,..
Any more sugestions?
Sounds like you need to use a RichTextBox to show your text. It allows you to format the text in any way you want. If you only want to display information in it and not let it be edit-able, set the ReadOnly property to True.
Hi thanks, Atheist,
I´ll have a look,..
Use GDI+ to draw your string directly onto your form. Then you have complete control over every character. You can have each character in a different font, some bold, some underlined, etc., etc.