CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2010
    Posts
    37

    Vertical spacing on a CMenu

    I have an MDI MFC application which has a menu at the top. Nothing particularly unusual about that, but for some reason my application seems to have a vertical spacing about 30%-40% bigger than "normal" on the drop down menus (when compared with Visual Studio itself).

    I've looked thru the options for CMenu, CMFCMenuBar, CMFCVisualManager, but can't seem to find anything to explain why my menu has such a large vertical spacing between options, nor how to change it.

    Name:  ScreenGrab_VisualStudioMenu.jpg
Views: 731
Size:  47.0 KB

    Any suggestions?

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

    Re: Vertical spacing on a CMenu

    You could change it using owner draw menu.
    Victor Nijegorodov

  3. #3
    Join Date
    Jul 2010
    Posts
    37

    Re: Vertical spacing on a CMenu

    Quote Originally Posted by VictorN View Post
    You could change it using owner draw menu.
    I *could*, and will if I have to, but it seems to be an awful lot of work for what seems to be a small change.
    When I create a new dummy MDI application, the menu spacing is normal, so it seems there must be something my application is doing/calling to make the vertical spacing larger. In the design view, my app's menu appears with normal spacing as well.

  4. #4
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: Vertical spacing on a CMenu

    When you create your app initially, you can select from a number of different looks, or styles for your app's appearance. I haven't messed with them much, but it's probably related to that. Look for OnApplicationLook in your CMainFrame class and see if you can change your app's style that way and see if it helps.

  5. #5
    Join Date
    Jul 2010
    Posts
    37

    Re: Vertical spacing on a CMenu

    I did play around with a number of different styles in the OnApplicationLook() function, but none of them seemed to affect the menu spacing.
    Creating a default, dummy, MDI application thru the wizard, I can create an application with the same settings as mine, but it still has the correct menu spacing.

    However, I have found a simple solution, which doesn't explain why this issue happened in the first place, but does seem to make it go away;

    CMFCMenuBar::SetMenuSizes( CSize(22, 22), CMFCMenuBar::GetMenuImageSize() );

    I've placed this line in my CMainFrame::OnApplicationLook() function, and it does the trick.

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