Fonts don't work!
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Fonts don't work!

  1. #1
    Join Date
    Nov 2008
    Posts
    21

    Fonts don't work!

    I begun working on a simple text editor around an extended richtextbox control, trying to improve the existing example from this page: http://www.codeproject.com/KB/vb/Wor...ick&fr=1#xx0xx, when i realised that the FontDialog doesn't work properly. Most of the fonts don't work. It just slips back into the default textbox font defined in the properties, or to the previous font. This is the code that opens the FontDialog box:

    Code:
     Private Sub SelectFontToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SelectFontToolStripMenuItem.Click
    
            If Not rtbDoc.SelectionFont Is Nothing Then
                FontDialog1.Font = rtbDoc.SelectionFont
            Else
                FontDialog1.Font = Nothing
            End If
    
            FontDialog1.ShowApply = True
    
            If FontDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
                rtbDoc.SelectionFont = FontDialog1.Font
            End If
    
        End Sub
    Font Broadway for example doesn't work, arial works, arial black works, batang works, bell mt doesn't work. I don't see the pattern.
    Last edited by HanneSThEGreaT; November 12th, 2008 at 03:54 AM. Reason: Added [Code] [/Code] tags!

  2. #2
    Join Date
    Nov 2008
    Posts
    21

    Re: Fonts don't work!

    FontDialog works fine. I tested it with a label. It must be then the extendedrichbox that's creating the problem. Or is it?

  3. #3
    Join Date
    Mar 2002
    Location
    NY, USA
    Posts
    12,097

    Re: Fonts don't work!

    It would be best if you could post a minimal yet complete example that reproduces the problem. I have not had any problems with setting the fontin a RTB....
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009
    In theory, there is no difference between theory and paractice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  4. #4
    Join Date
    Nov 2008
    Posts
    21

    Re: Fonts don't work!

    But i did post the code in the first message. That code is ok i think. The entire solution source code is on that link in the first message. You can download the project and test it yourself if you've got time. It doesn't take long. And you will see that you can apply only a handful of fonts to the richtextbox, and the rest reverts back to the default or previous font. Thanks.

  5. #5
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,091

    Re: Fonts don't work!

    The author of that article likes to make his / her life difficult.
    Toggling Bold, Italic, Underline, Font(s) can be done much easier

    I'm feeling like Father Christmas today, so I'll send you a demo app I've written some time ago
    It's not as fully featured as the one in the article, but still useful - to me at least LOL!

    Have a look at how I toggled Bold, Underline, Italic and the font(s).

    I hope it helps, even if it's a little
    Last edited by HanneSThEGreaT; June 14th, 2010 at 05:39 AM.

Tags for this Thread

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center