changing font on a CEdit control 
Author Message
 changing font on a CEdit control

Hi all,
I'd like to change the font on a CEdit control.

For now, I use this code :
-----------------------
 LOGFONT DescNewsFont;  //structure with font attributes
CFont NewsFont; //Font Object

 CFont* pfont = m_TextNews.GetFont(); //Get actual Font of the CEdit control
 pfont->GetLogFont( &DescNewsFont); //fill in LOGFONT structure

 DescNewsFont.lfItalic = TRUE; //modify the LOGFONT structure

 NewsFont.CreateFontIndirect( &DescNewsFont ); //Create the new Font

 m_TextNews.SetFont( &NewsFont, TRUE); //Set it to the CEdit control
------------------
I don't have the expected result (characters become bold but not italic).

Any sugestion?

thank you...



Sat, 20 Sep 2003 18:02:48 GMT  
 changing font on a CEdit control
I guess this is because your font  object (NewFont) is declared as a local
object
created temporarily in stack.  Try extend the object's life time.

Makoto


Quote:
> Hi all,
> I'd like to change the font on a CEdit control.

> For now, I use this code :
> -----------------------
>  LOGFONT DescNewsFont;  file://structure with font attributes
> CFont NewsFont; file://Font Object

>  CFont* pfont = m_TextNews.GetFont(); file://Get actual Font of the CEdit
control
>  pfont->GetLogFont( &DescNewsFont); file://fill in LOGFONT structure

>  DescNewsFont.lfItalic = TRUE; file://modify the LOGFONT structure

>  NewsFont.CreateFontIndirect( &DescNewsFont ); file://Create the new Font

>  m_TextNews.SetFont( &NewsFont, TRUE); file://Set it to the CEdit control
> ------------------
> I don't have the expected result (characters become bold but not italic).

> Any sugestion?

> thank you...



Sat, 20 Sep 2003 18:29:56 GMT  
 changing font on a CEdit control
I'm so stupid!
thanx very much!



Quote:
> I guess this is because your font  object (NewFont) is declared as a local
> object
> created temporarily in stack.  Try extend the object's life time.

> Makoto


message

> > Hi all,
> > I'd like to change the font on a CEdit control.

> > For now, I use this code :
> > -----------------------
> >  LOGFONT DescNewsFont;  file://structure with font attributes
> > CFont NewsFont; file://Font Object

> >  CFont* pfont = m_TextNews.GetFont(); file://Get actual Font of the
CEdit
> control
> >  pfont->GetLogFont( &DescNewsFont); file://fill in LOGFONT structure

> >  DescNewsFont.lfItalic = TRUE; file://modify the LOGFONT structure

> >  NewsFont.CreateFontIndirect( &DescNewsFont ); file://Create the new
Font

> >  m_TextNews.SetFont( &NewsFont, TRUE); file://Set it to the CEdit
control
> > ------------------
> > I don't have the expected result (characters become bold but not
italic).

> > Any sugestion?

> > thank you...



Sat, 20 Sep 2003 21:28:55 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Changing Font in a CEdit control

2. Changing Fonts for a CEdit control?

3. changing font size in CEdit control

4. Changing Font in CEdit control

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

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

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

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

9. CEdit control .. change Font selection

10. CEdit controls and changing the font color

11. Changing the font of a multiline CEdit Control

12. Changing font style in CEdit derived control.

 

 
Powered by phpBB® Forum Software