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

    Change Font in EditBox

    How can I change font in EditBox?
    Thanx.


  2. #2
    Join Date
    Jul 1999
    Location
    Moscow, Russia
    Posts
    667

    Re: Change Font in EditBox

    In OnInitDialog try use this:

    CWindowDC dcText(&m_MyEdit);
    CFont* pFont=dcText.GetCurrentFont( );
    LOGFONT lf;
    pFont->GetLogFont(&lf);
    // For instance:
    lf.lfUnderline =TRUE;//Change font to be underlined
    m_Font.CreateFontIndirect (&lf)
    m_MyEdit.SetFont(&m_Font);




    where m_Font declared as CFont , m_MyEdit declared as CEdit in your CDialog derived.

    At run-time you can get a pointer to CEdit using GetDlgItem:
    CEdit *pEdit=(CEdit *)GetDlgItem(ID_EDIT1);


    Hope this helps,
    Oleg.


  3. #3
    Join Date
    Sep 1999
    Posts
    52

    Re: Change Font in EditBox

    Thanx, your hopes comes true, and i found another way.

    LOGFONT lf;
    GetDlgItem(IDC_OUTPUT)->GetFont()->GetLogFont(&lf);

    strcpy(lf.lfFaceName, "Fixedsys");
    fnt.CreateFontIndirect(&lf);
    GetDlgItem(IDC_OUTPUT)->SetFont(&fnt);





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