Solved

ContextMenuStrip

Posted on 2006-11-14
6
569 Views
Last Modified: 2007-12-19
I have created submenus on a contextmenustrip.
I have removed the image margin on the main menu, but I can't see a way of doing this on sub-menus.
Also how can I change the back colour of an item when hovering over it?
0
Comment
Question by:broadbent
[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
  • 3
  • 3
6 Comments
 
LVL 12

Expert Comment

by:Alfredo Luis Torres Serrano
ID: 17939944
It is possible to do this but its not intuitive:

1. Drag a ContextMenuStrip onto your form, it will be named contextMenuStrip1
2. Add a menu item to the context menu to contextMenuStrip1
3. Drag another ContextMenuStrip onto your form, it will be named contextMenuStrip2
4. Select the menu item created in 2 and set its DropDown property to contextMenuStrip2
5. Change ShowImargeMargin for both contextMenuStrip1 and contextMenuStrip2 to false

And that's it. For every submenu you create you will need a separate context menu strip which is a bit silly.
0
 
LVL 4

Author Comment

by:broadbent
ID: 17940503
Sorry but you've misunderstood the question

ContextMenuStrip                  ShowImageMargin=False
 |
  MenuItem1                           no image margin
  MenuItem2
  MenuItem3 -> MenuItem3a       image margin
                        MenuItem3b

MenuItems1-3 are in the ContextMenuStrip.Items collection
MenuItem3a and b are in the MenuItem3.DropdownItems collection

I want all the menuitems to have no image margin.
0
 
LVL 12

Expert Comment

by:Alfredo Luis Torres Serrano
ID: 17940880
Menuitem3a and menuitem3b have to be differentes menu strips. as i say in myu comment

 For every submenu you create you will need a separate context menu strip which is a bit silly.
 Change ShowImargeMargin  for each menustrip

0
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!

 
LVL 4

Author Comment

by:broadbent
ID: 17945673
Then why does the IDE allow you to enter submenus?
Is this a bug?
0
 
LVL 12

Accepted Solution

by:
Alfredo Luis Torres Serrano earned 250 total points
ID: 17947161
Nope this is not a bug.

I actually suggest that you post a suggestion on the Microsoft Product Feedback Center suggesting that the menu items follow their parent (in this case the ContextMenuStrip) when it comes to displaying the image margin.

0
 
LVL 4

Author Comment

by:broadbent
ID: 17947309
AQctually what about the other part of the question-
Also how can I change the back colour of an item when hovering over it?
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…

710 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