• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 507
  • Last Modified:

Images next to a menu item using SetMenuItemBitmaps

I have an MDI form with a menu and was attempting to place images next to some of the sub menu options.  The problem I am experiencing is the image appears to get cut off.  For example:

If I have a &Edit menu and under that I have a &Cut menu option that I want to place a picture of scissors next to it.  I Add the bmp to an imagelist and attempt to load it into the menu using the SetMenuItemBitmaps API however I only see some of the image.  Am I missing something here?  Does the image have to be a certain size?  I was using the exact bmp files for cut, copy & paste as MS does in there office products.  Any help?
0
brian_andrews
Asked:
brian_andrews
  • 6
  • 3
  • 2
  • +3
1 Solution
 
wsh2Commented:
<ping>
0
 
brian_andrewsAuthor Commented:
???
0
 
BozzoCageCommented:
ignore wsh2 - it pings everyone (he doesn't like to buy PAQ)
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
BozzoCageCommented:
well, icons certainly must be of proper size (windows doesn't resize them automatically)
0
 
Éric MoreauSenior .Net ConsultantCommented:
You can use this free control instead of using SetMenu: http://vbaccelerator.com/codelib/cpopmenu/article.htm
0
 
DennisBorgCommented:
Brian:

You can use the GetSystemMetrics() Win API function to get the width and height of menu bitmaps.

Add the following to a standard code module (.bas):

Public Const SM_CXMENUCHECK = 71
Public Const SM_CYMENUCHECK = 72

Public Declare Function GetSystemMetrics Lib "user32" Alias "GetSystemMetrics" (ByVal nIndex As Long) As Long


You can get the width and height (in pixels) as follows:

   Dim MenuBMPWidth  As Long
   Dim MenuBMPHeight As Long

   MenuBMPWidth = GetSystemMetrics(SM_CXMENUCHECK)
   MenuBMPHeight = GetSystemMetrics(SM_CYMENUCHECK)


Compare the results with the dimensions of your bitmaps, and you can tell whether they're bigger than the system allows.


-Dennis Borg
0
 
brian_andrewsAuthor Commented:
After looking at some of the menus in, lets say the Visual Basic IDE, they are completely different than the ones that VB allows you to create.  The menus in the Visual Basic IDE allow for a much bigger picture and also are reacting to my mouse over event.
0
 
DennisBorgCommented:
>After looking at some of the menus in, lets say the
>Visual Basic IDE, they are completely different
>than the ones that VB allows you to create.  The menus in
>the Visual Basic IDE allow for a much bigger
>picture and also are reacting to my mouse over event.

To achieve those same effects, you would either need to find a 3rd party solution, or create your own owner-drawn menues.

Another effect you can achieve with owner-drawn menues is to have things such as that vertical "titlebar" on the left-hand side (or wherever) of the menu, such as the Start Menu has.

Ownerdrawn menues can be done in VB, but it's a little involved.


-Dennis Borg
0
 
wsh2Commented:
emoreau.. respectfully, in my experience, CPOPMENU is quite heavy AND buggy. Unless you are extremely technically competent I would avoid using it.
0
 
Éric MoreauSenior .Net ConsultantCommented:
I use it since 3 years now in many applications without problems!
0
 
wsh2Commented:
Calrifying the Buggy part of CPOPMENU.. it principally had to do with the dynamic Menu creation/update portions of the code.
0
 
Éric MoreauSenior .Net ConsultantCommented:
I use it mainly for the icons part.
0
 
Éric MoreauSenior .Net ConsultantCommented:
Please maintain:

Questions Asked 8
Last 10 Grades Given A A A A A A  
Question Grading Record 6 Answers Graded / 7 Answers Received
0
 
Éric MoreauSenior .Net ConsultantCommented:
Please maintain:

Questions Asked 9
Last 10 Grades Given A A A A A A A  
Question Grading Record 7 Answers Graded / 8 Answers Received
0
 
Éric MoreauSenior .Net ConsultantCommented:
Anybody here ?
0
 
NetminderCommented:
There has been no activity in this question in quite some time, and it looks like it has been abandoned. As part of our ongoing mission to clean up the topic areas, a Moderator will finalize this question within the next seven (7) days. At that time, either I or one of the other Moderators will force/accept the comment of emoreau.

DO NOT ACCEPT THIS COMMENT AS AN ANSWER. If you have further comments on this question or the recommendation, please leave them here.

Netminder
Community Support Moderator
Experts Exchange
0
 
NetminderCommented:
Per recommendation comment force/accepted by

Netminder
Community Support Moderator
Experts Exchange
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 6
  • 3
  • 2
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now