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

    How to modify the width of a context menu ?

    Hello,

    Is there a member function to modify the width of a context menu.

    Can ModifyMenu() be used in any way?

    Thanks in advance

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

    Re: How to modify the width of a context menu ?

    The width of popup menu depends on the width of menu item texts!
    Victor Nijegorodov

  3. #3
    Join Date
    Apr 2008
    Posts
    90

    Re: How to modify the width of a context menu ?

    But it appears like lot of space are padded to the left and right of the string.

    Do I have to change any menu style for this.

    Thanks

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

    Re: How to modify the width of a context menu ?

    What do you mean by "lot"?
    For example, space to the left of item text is used/reserved for item icons (like ckeckbox or any user defined icon).
    Space to the right of item text is used/reserved for the symbol signing the pop-up menu (see the attached picture)
    So, what "space" would you like to reduce?
    Attached Images Attached Images  
    Victor Nijegorodov

  5. #5
    Join Date
    Dec 2008
    Posts
    114

    Re: How to modify the width of a context menu ?

    Just get the window menu HWND and change its width

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

    Re: How to modify the width of a context menu ?

    Please, supply some lines of code to "get the window menu HWND".
    Victor Nijegorodov

  7. #7
    Join Date
    Jul 2005
    Posts
    266

    Re: How to modify the width of a context menu ?

    The only way I can think of is if the menu's owner-draw flag is set and you handle drawing and measuring manually. Altho maybe a menu HWND can be obtained through ::FindWindow("#32768",NULL) for MFC menus and some manipulation can be done on it but i dont think it is likely to work.

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