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

    How to dynamic create a Rich Edit control on the Client Area ?

    Dear All,

    I encounted a problem with using Rich Edit control.

    After I dynamic create the control on the Client Area, I can't use SetWindowText(..) to change the text. Can anyone show me the sample ?


    Wallace.

  2. #2
    Join Date
    Jun 2004
    Location
    Philippines
    Posts
    31
    Wallace@Kuo,

    SetWindowText() does not work for richedit control. You may want to take at look at the work of PlanetCPP-Chris(Hound)/Micheal(xix)

    I have downloaded the CPP project from that site and it is working perfectly.
    I am inviting you to join GreenZap. It is just like PAYPAL but it is more rewarding! You get $25 when you join (FREE to sign up) AND you get rewarded also when someone opened an account using your GreenZap promo code! GreenZap is launching June 1st.

    Click here and PREREGISTER

    Have a break. Visit JonelsPlace

  3. #3
    Join Date
    Aug 2004
    Posts
    3
    Quote Originally Posted by jbp2004
    Wallace@Kuo,

    SetWindowText() does not work for richedit control. You may want to take at look at the work of PlanetCPP-Chris(Hound)/Micheal(xix)

    I have downloaded the CPP project from that site and it is working perfectly.
    Thanks for jbp2004 reply. I'll try to download the sample for studing.

    Another question, I have the sample code for changing the font of Rich Edit control, and its written by MFC as below:

    CFont font;
    font.CreateStockObject(ANSI_FIXED_FONT);
    m_wndEditCtrl.SetFont(&font);
    ....

    How do I implement the code with API ? In API, the CreateStockObject() and SetFont() are delivered from which function call ?


    Wallace.

  4. #4
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,244
    Code:
       HFONT hFont = (HFONT)GetStockObject(ANSI_FIXED_FONT);
       SendMessage(hWndRich, WM_SETFONT, (WPARAM)hFont, TRUE);
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  5. #5
    Join Date
    Aug 2004
    Posts
    3
    Quote Originally Posted by ovidiucucu
    Code:
       HFONT hFont = (HFONT)GetStockObject(ANSI_FIXED_FONT);
       SendMessage(hWndRich, WM_SETFONT, (WPARAM)hFont, TRUE);

    thanks for Ovidiucucu reply.

    I use the way listed below to change the font style; I think they are the same.

    hf = CreateFont(
    16, 0, 0, 0,
    FW_NORMAL, FALSE, FALSE, FALSE,
    ANSI_CHARSET, OUT_DEFAULT_PRECIS,
    CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS,
    "Courier New");

    Wallace.

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