Solved

Images next to a menu item using SetMenuItemBitmaps

Posted on 2001-08-16
17
460 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ms access #TYPE! error on report when no data 4 63
Vb.net 2008 2 56
Run code from text file in vb 1 56
Convert VB6 MSXML2.ServerXMLHTTP process to C# 2 40
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

947 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

18 Experts available now in Live!

Get 1:1 Help Now