CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2008
    Posts
    1

    ChooseFont dialog not displaying sample font

    I am having a bit of trouble figuring this one out. I have copied several code snippets that work perfectly, yet my program does not. I have included libraries that the other programs had, but still nothing.

    When the choose font dialog pops, it is not displaying the sample font in the sample font static control.

    Here is the code snippet I am using:

    CHOOSEFONT cf ;

    cf.lStructSize = sizeof (CHOOSEFONT) ;
    cf.hwndOwner = hWndDlg ;
    cf.hDC = NULL ;
    cf.lpLogFont = &logfont ;
    cf.iPointSize = 0 ;
    cf.Flags = CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS |
    CF_EFFECTS ;
    cf.rgbColors = 0 ;
    cf.lCustData = 0 ;
    cf.lpfnHook = NULL ;
    cf.lpTemplateName = NULL ;
    cf.hInstance = NULL ;
    cf.lpszStyle = NULL ;
    cf.nFontType = 0 ; // Returned from ChooseFont
    cf.nSizeMin = 0 ;
    cf.nSizeMax = 0 ;

    ChooseFont (&cf);

    I am programming in c++ with VS2005 under vista32.

    Any insight would be appreciated.

  2. #2
    Join Date
    Sep 2007
    Location
    poland|wrocław
    Posts
    47

    Re: ChooseFont dialog not displaying sample font

    My way:
    Code:
    CHOOSEFONT chFont;
    	ZeroMemory( &chFont, sizeof( CHOOSEFONT ));
    	chFont.lStructSize = sizeof( CHOOSEFONT );
    	chFont.hwndOwner = aParent;
    	chFont.lpLogFont = &mv_customizedFont[m_StatPoped].first;
    	chFont.Flags = CF_SCREENFONTS | CF_EFFECTS;
    	result = ChooseFont( &chFont );

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