Results 1 to 6 of 6

Thread: bold in a label (resolved)

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2004
    Location
    traverse city
    Posts
    64

    bold in a label (resolved)

    how can i have one label with some of the text be normal text and but the rest of it text would be in bold. thanks
    Last edited by beowulf; Apr 12th, 2004 at 09:09 PM.

  2. #2
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246
    You can't. You need to use the RichTextBox control, set its Borderstyle property to None, locked property to True, and then you can use it like this:
    VB Code:
    1. RichtextBox.SelBold = True
    2. RichTextBox.SelText = "This is bold,"
    3. RichTextBox.SelBold = False
    4. RichTextBox.SelText = " and this is not"

    EDIT:
    If you don't know how to add a RichTextBox to your program, right click the toolbox (the thing where all the other controls are, on the left in VB), and click Components...

    When the window appears, scroll down until you see "Microsoft RichTextBox Control", tick that, and click OK


    Phreak

    Visual Studio 6, Visual Studio.NET 2005, MASM

  3. #3
    Lively Member
    Join Date
    Dec 2003
    Location
    Michigan
    Posts
    101
    you can't make individual words in a single label bold or not......the only way to do this would be to seperate all the words in the label, store them into strings, and then place them back in label manually......all this of course would be a pain....so you probabaly want to not do it...

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jan 2004
    Location
    traverse city
    Posts
    64
    thanks all, not the answer i wanted but what can you do.

  5. #5
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    You can go a little further than «°°phReAk°°»'s example. Put a RichTextBox inside a frame and use code like the following:

    VB Code:
    1. RichTextBox1.Appearance = rtfFlat ' Set this at design time
    2. RichTextBox1.BorderStyle = rtfNoBorder
    3. RichTextBox1.BackColor = Me.BackColor
    4. RichTextBox1.TabStop = False
    5.  
    6. Frame1.Enabled = False
    7. Frame1.BorderStyle = 0
    8.  
    9. RichTextBox1.Text = "Please press the "
    10. RichTextBox1.SelStart = 18
    11. RichTextBox1.SelItalic = True
    12. RichTextBox1.SelBold = True
    13. RichTextBox1.SelText = "&xxx& "
    14. RichTextBox1.SelStart = 26
    15. RichTextBox1.SelItalic = False
    16. RichTextBox1.SelBold = False
    17. RichTextBox1.SelText = " button"

  6. #6
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246
    Wow. It seems so stupid for me not to think about that..

    Phreak

    Visual Studio 6, Visual Studio.NET 2005, MASM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width