Solved

Images next to a menu item using SetMenuItemBitmaps

Posted on 2001-08-16
17
453 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
  • 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
 
LVL 2

Expert Comment

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

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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
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 69

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 69

Expert Comment

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

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 69

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 69

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now