Solved

Images next to a menu item using SetMenuItemBitmaps

Posted on 2001-08-16
17
479 Views
Last Modified: 2012-08-13
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
Comment
Question by:brian_andrews
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
  • 2
  • +3
17 Comments
 
LVL 14

Expert Comment

by:wsh2
ID: 6394142
<ping>
0
 

Author Comment

by:brian_andrews
ID: 6394242
???
0
 
LVL 2

Expert Comment

by:BozzoCage
ID: 6394855
ignore wsh2 - it pings everyone (he doesn't like to buy PAQ)
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 2

Expert Comment

by:BozzoCage
ID: 6394862
well, icons certainly must be of proper size (windows doesn't resize them automatically)
0
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 100 total points
ID: 6395323
You can use this free control instead of using SetMenu: http://vbaccelerator.com/codelib/cpopmenu/article.htm
0
 
LVL 8

Expert Comment

by:DennisBorg
ID: 6395376
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
 

Author Comment

by:brian_andrews
ID: 6396939
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
 
LVL 8

Expert Comment

by:DennisBorg
ID: 6397319
>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
 
LVL 14

Expert Comment

by:wsh2
ID: 6397623
emoreau.. respectfully, in my experience, CPOPMENU is quite heavy AND buggy. Unless you are extremely technically competent I would avoid using it.
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 6397680
I use it since 3 years now in many applications without problems!
0
 
LVL 14

Expert Comment

by:wsh2
ID: 6397746
Calrifying the Buggy part of CPOPMENU.. it principally had to do with the dynamic Menu creation/update portions of the code.
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 6397774
I use it mainly for the icons part.
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 6449508
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
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 6521943
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
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 6626531
Anybody here ?
0
 
LVL 5

Expert Comment

by:Netminder
ID: 6767065
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
 
LVL 5

Expert Comment

by:Netminder
ID: 6789848
Per recommendation comment force/accepted by

Netminder
Community Support Moderator
Experts Exchange
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question