|
-
May 11th, 2007, 05:49 AM
#1
Thread Starter
Hyperactive Member
[2.0] Easy question on a Label
Hi,
Just say I´d like this string:
Code:
string text = "Hello my friend";
Added to a label;
Code:
label1.text = text;
Now say, I´d like to format part of the string, bold.
How can I go about doing this? This is C# Winforms.
Thanks!.
-
May 11th, 2007, 05:53 AM
#2
Thread Starter
Hyperactive Member
Re: [2.0] Easy question on a Label
Hi, I´d also like to know how to add or append a string to the lable, with a certain indentation, or padding,...
Thanks,..!
Last edited by Rauland; May 11th, 2007 at 05:54 AM.
Reason: mistype
-
May 11th, 2007, 06:32 AM
#3
Thread Starter
Hyperactive Member
Re: [2.0] Easy question on a Label
for the margin I´ve added:
"\t" + "Some text", but It doesn´t like it either,..
-
May 12th, 2007, 04:58 AM
#4
Re: [2.0] Easy question on a Label
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:
Last edited by Atheist; May 12th, 2007 at 05:23 AM.
-
May 12th, 2007, 07:19 AM
#5
Thread Starter
Hyperactive Member
Re: [2.0] Easy question on a Label
Hi, thanks for the reply,
How can I make all of it bold from code?
For instance:
Code:
String text = "Hello";
Label1.Text += text;
HOw would you make text bold?
-
May 12th, 2007, 08:18 AM
#6
Re: [2.0] Easy question on a Label
C# Code:
label1.Font = new Font(label1.Font, FontStyle.Bold);
-
May 12th, 2007, 09:03 AM
#7
Re: [2.0] Easy question on a Label
Also i would watch using words like Text i don't believe it is a reserved word in C# but some words are.
-
May 12th, 2007, 09:19 AM
#8
Thread Starter
Hyperactive Member
Re: [2.0] Easy question on a Label
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?
-
May 12th, 2007, 09:28 AM
#9
Re: [2.0] Easy question on a Label
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.
-
May 13th, 2007, 03:37 AM
#10
Thread Starter
Hyperactive Member
Re: [2.0] Easy question on a Label
Hi thanks, Atheist,
I´ll have a look,..
Last edited by Rauland; May 13th, 2007 at 05:35 AM.
-
May 15th, 2007, 04:53 AM
#11
Re: [2.0] Easy question on a Label
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|