How to change the font size for a CEdit control 
Author Message
 How to change the font size for a CEdit control

I am using a CFormView and on it I have a CEdit control. I
want to change the size of the font for the control.

In the OnInitialUpdate() of the CFormView, I am trying a
number of various ways to set the Font Size, but I seem to
be misunderstanding something.

void MyForm::OnInitialUpdate()
{
        CFormView::OnInitialUpdate();
        LOGFONT lf;
        memset(&lf, 0, sizeof(LOGFONT));       // clear
out structure.
        lf.lfHeight = 720;                     // request
a 72-pixel-height font
        strcpy(lf.lfFaceName, "Arial");        // request
a face name "Arial".

        CFont font;
        font.CreatePointFontIndirect(&lf);

        m_equation.SetFont(&font);  
        m_equation.SetWindowText("12x12");

Quote:
}

If I go to edit in the control, I get an insertion point
which seems to be 72 points high, but the text in the
control always remains at the 12 point size.

Any ideas?

Sincerely,
Lindsay



Sat, 14 Aug 2004 02:01:00 GMT  
 How to change the font size for a CEdit control
You font variable goes out of scope when you exit OnInitialUpdate. Make it a
member of MyForm.

--
Ajay Kalra [MVP - VC++]


Quote:
> I am using a CFormView and on it I have a CEdit control. I
> want to change the size of the font for the control.

> In the OnInitialUpdate() of the CFormView, I am trying a
> number of various ways to set the Font Size, but I seem to
> be misunderstanding something.

> void MyForm::OnInitialUpdate()
> {
> CFormView::OnInitialUpdate();
> LOGFONT lf;
> memset(&lf, 0, sizeof(LOGFONT));       // clear
> out structure.
> lf.lfHeight = 720;                     // request
> a 72-pixel-height font
> strcpy(lf.lfFaceName, "Arial");        // request
> a face name "Arial".

> CFont font;
> font.CreatePointFontIndirect(&lf);

> m_equation.SetFont(&font);
> m_equation.SetWindowText("12x12");
> }

> If I go to edit in the control, I get an insertion point
> which seems to be 72 points high, but the text in the
> control always remains at the 12 point size.

> Any ideas?

> Sincerely,
> Lindsay



Sat, 14 Aug 2004 02:43:00 GMT  
 How to change the font size for a CEdit control
Whoops. It's a Monday...

Thank you for opening my eyes.

Sincerely,
Lindsay.



Sat, 14 Aug 2004 03:51:07 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. changing font size in CEdit control

2. Changing font size in CEdit and Text controls

3. Any body knows how to change the font size in an CEdit control?

4. Any body knows how to change the font size in an CEdit control?

5. Changing Font in CEdit control

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

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

8. changing font on a CEdit control

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

10. Changing Font in a CEdit control

11. CEdit control .. change Font selection

12. CEdit controls and changing the font color

 

 
Powered by phpBB® Forum Software