Results 1 to 3 of 3

Thread: Bold Italic and Underlined

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2004
    Location
    Sydney
    Posts
    51

    Bold Italic and Underlined

    In my Wordpad application,I have 3 buttons doing the font functions Bold, Italic and Underlined.
    All 3 buttons are Push Buttons.
    I have done the following,

    If all 3 buttons are clicked:

    Richtextbox1.Font=New Font(Combobox1.Text,Combobox2.Text,Font.StyleBold AND Font.StyleItalic AND Font.StyleUnderlined)

    But the code doesnt seem to work.

  2. #2
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    Re: Bold Italic and Underlined

    Quote Originally Posted by cybertechno
    In my Wordpad application,I have 3 buttons doing the font functions Bold, Italic and Underlined.
    All 3 buttons are Push Buttons.
    I have done the following,

    If all 3 buttons are clicked:

    Richtextbox1.Font=New Font(Combobox1.Text,Combobox2.Text,Font.StyleBold AND Font.StyleItalic AND Font.StyleUnderlined)

    But the code doesnt seem to work.
    use OR instead of AND?
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  3. #3
    Frenzied Member zaza's Avatar
    Join Date
    Apr 2001
    Location
    Borneo Rainforest Habits: Scratching
    Posts
    1,486

    Re: Bold Italic and Underlined

    Hi,

    I'm not sure you need to bother with such things. After all, presumably each button will function independently of the others so that you could set Bold or Italic or Underline on their own. An easier way to do it would thus be to have a general "Font flag" to which clicking on Bold adds 1, Italic adds 2 and Underline adds 4 (I think these are the numbers, but you can look them up in the Help), and conversely subtracts if you click off the push button. Then you can always just use the value of "Font Flag" in the [style] part of the argument.
    Does that make sense?

    HTH

    zaza

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