CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2006
    Posts
    60

    CEdit box with variable fonts

    I want to change the fonts of the text in my mutli-line editbox. I've found how to change the default font of the entire control, but it is possible to just change one line to either bold or underline? If so, how?

    For example: I currently write to the editbox like this:
    CString textstr = "hello world\r\nFoobar";
    CEdit * Editbox1 = (CEdit*) GetDlgItem(IDC_EDIT1);
    Editbox1 ->SetWindowText(textstr);

    How would I make "Foobar" bold, and "hello world" regular?

  2. #2
    Join Date
    Feb 2009
    Posts
    42

    Re: CEdit box with variable fonts

    I think that isn't possible. You may use rich control, in which you can format your text.

  3. #3
    Join Date
    Dec 2006
    Posts
    60

    Re: CEdit box with variable fonts

    how do I do that with visual c++ 6.0?

  4. #4
    Join Date
    Feb 2002
    Posts
    3,788

    Re: CEdit box with variable fonts

    Quote Originally Posted by acerunner316 View Post
    how do I do that with visual c++ 6.0?
    replace your CEdit with a CRichEditCtrl

  5. #5
    Join Date
    Dec 2006
    Posts
    60

    Re: CEdit box with variable fonts

    i mean how do you select certain portions of the text to be a specific font?
    CRichEditCtrl uses SetFont() but that sets the entire control to that font.

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

Featured