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

    change menu bar font size

    Can you change the menu bar font size in CMainFrame::OnCreate()? Here's what I have:

    Code:
    int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
    {    
       
        CRect rect;
        GetClientRect(&rect);
        if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
        {
            return -1;
        }
        
    	if (!m_wndToolBar.Create(this))
    	{
    		TRACE0("Failed to create toolbar\n");
    		return -1;      // fail to create
    	}
    	m_font.CreatePointFont(165, "Arial");
    	m_wndToolBar.SetFont(&m_font);
        if (!m_wndStatusBar.Create(this) ||
            !m_wndStatusBar.SetIndicators(indicators,
            sizeof(indicators)/sizeof(UINT)))
        {
            TRACE0("Failed to create status bar\n");
            return -1;
        }
    
        
        
        
        return 0;
    }
    The line "m_wndToolBar.SetFont(&m_font);" does nothing. I found article on code guru http://www.codeguru.com/cpp/controls...ep-by-Step.htm. I will probably just use this if I can't make this work. But just wanted to ask. Thanks!!

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: change menu bar font size

    You either change the font in all menus that will be displayed in any application in your PC or you create an owner draw menu to change font only in this menu.
    Victor Nijegorodov

  3. #3
    Join Date
    Mar 2011
    Posts
    60

    Re: change menu bar font size

    Quote Originally Posted by VictorN View Post
    You either change the font in all menus that will be displayed in any application in your PC or you create an owner draw menu to change font only in this menu.
    Ok, Thanks. I downloaded the demo project that I linked to in the OP and I'm just playing around with it to change the menu bar font. How would I change the menu bar font size in this demo application? I make my own font using "m_font.CreatePointFont(165, "Arial");". Then I try to set the font in OnCreate in the MainFrm.cpp, but the font doesn't change. Again thanks for the help!!!

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