Results 1 to 9 of 9

Thread: [RESOLVED] Treeview Node Font

Threaded View

  1. #6
    You don't want to know.
    Join Date
    Aug 2010
    Posts
    4,578

    Re: Treeview Node Font

    Didn't see this:
    Quote Originally Posted by techgnome View Post
    Why this
    Code:
    Dim f As New Font("Microsoft Sans Serif", 8, FontStyle.Underline)
    Dim f2 As New Font(f, FontStyle.Bold)
    when this works:
    Code:
    Dim f As New Font("Microsoft Sans Serif", 8, FontStyle.Underline & FontStyle.Bold)
    (to be fair, I can't remember if the flags should be & together or + together... one or both should work).

    -tg
    Smart-aleck answer: because the '&' operator is only used for bitwise operations in C#.

    Other smart-aleck answer: because the first block of code doesn't try to make the text bold AND underlined, that constructor for Font() should read as follows: "Use the same font size and family as this font, but let me define a new style".

    Also: you can't misspell a font name when you use the original font as the "prototype".

    Also: MS Sans Serif was the default font for Win 3.1, it's time to move to Segoe UI or at least Tahoma.

    It's generally more common that you have a not-bold font you want to make bold, and it's a pain in the butt to grab all the other stuff you need to make the font. So this is a convenience overload. Not every project uses the same font throughout, and in situations like a RichTextBox you can have a multitude of Font objects in play.
    Last edited by Sitten Spynne; Mar 7th, 2017 at 02:05 PM.

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