Changing the font of a multiline CEdit Control 
Author Message
 Changing the font of a multiline CEdit Control

Here is some sample code:

BOOL CMyBox::OnInitDialog()
{
   LOGFONT lf;                  

   CDialog::OnInitDialog();          

   memset(&lf, 0, sizeof(LOGFONT));  
   lf.lfHeight = 20;                  
   strcpy(lf.lfFaceName, "Arial");    
   m_font.CreateFontIndirect(&lf);    

   GetDlgItem(IDC_TEXT1)->SetFont(&m_font);

   return TRUE;

Quote:
}

Ajay Kalra

Quote:

>Env: VC++ 6.0 SP3, Win NT 4.0 SP4

>Hi,

>I need to change the font of a multiline CEdit box to a Fixed width font. I
>know that the CEdit control has a SetFont method, but I couldn't figure out
>how to use the CreateFont method of CFont to go about doing this. Could
>someone help me out with this.

>Thanks,

>With Regards,

>Anuj Seth



Sun, 02 Dec 2001 03:00:00 GMT  
 Changing the font of a multiline CEdit Control
Env: VC++ 6.0 SP3, Win NT 4.0 SP4

Hi,

I need to change the font of a multiline CEdit box to a Fixed width font. I
know that the CEdit control has a SetFont method, but I couldn't figure out
how to use the CreateFont method of CFont to go about doing this. Could
someone help me out with this.

Thanks,

With Regards,

Anuj Seth



Mon, 03 Dec 2001 03:00:00 GMT  
 Changing the font of a multiline CEdit Control
Take a look at the MSDN article 85518
"Correct use of the SetFont() Function in MFC"
I had the same problem last week. This article served my needs.
Good luck.
Quote:

> Env: VC++ 6.0 SP3, Win NT 4.0 SP4

> Hi,

> I need to change the font of a multiline CEdit box to a Fixed width font. I
> know that the CEdit control has a SetFont method, but I couldn't figure out
> how to use the CreateFont method of CFont to go about doing this. Could
> someone help me out with this.

> Thanks,

> With Regards,

> Anuj Seth



Mon, 03 Dec 2001 03:00:00 GMT  
 Changing the font of a multiline CEdit Control

Quote:
>I need to change the font of a multiline CEdit box to a Fixed width font. I
>know that the CEdit control has a SetFont method, but I couldn't figure out
>how to use the CreateFont method of CFont to go about doing this. Could
>someone help me out with this.

Have a look at Q85518 "Correct Use of the SetFont() Function in MFC".

Here's an example that generates an italic font for a control. You'd
normally do this in OnInitDialog:

        /* Get the dialog font */
        CFont * pFont = GetFont();

        LOGFONT lf;

        /* Get the LOGFONT for the font */
        pFont->GetLogFont( &lf );

        /* m_iFont is a CFont member variable of the dialog class */
        m_iFont.CreateFontIndirect( &lf );

        /* Make the control use the same font */
        pButtonCOntrol->SetFont( &m_iFont );

Dave
----
My address is altered to discourage junk mail.
Please post responses to the newsgroup thread,
there's no need for follow-up email copies.



Mon, 03 Dec 2001 03:00:00 GMT  
 Changing the font of a multiline CEdit Control
Hi,

Thanks for all the help. I've managed to solve the problem with all your
comments.

BTW, There is a fantastic utility called GetF in CodeGuru which generates
the parameters for you. All you have to do is select the font!!

Thanks once again,

With Regards,

Anuj Seth



Tue, 04 Dec 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Multiline Edit control and changing font

2. Changing Font in CEdit control

3. Changing the font of a CEdit control (non dialog)

4. How can I change the font of a CEdit control

5. How to change the font size for a CEdit control

6. changing font on a CEdit control

7. How to change font of run-time CEdit controls

8. Changing Font in a CEdit control

9. CEdit control .. change Font selection

10. CEdit controls and changing the font color

11. Changing font style in CEdit derived control.

12. Changing Fonts for a CEdit control?

 

 
Powered by phpBB® Forum Software