![]() |
Desktop Development »
Menus »
Custom menus
Intermediate
License: The Code Project Open License (CPOL)
Super Context MenuBy Hany BadrousHow to build a context menu that display any group of controls |
C#, Windows, .NET, Dev, Design
|
|
Advanced Search |
|
|
|
||||||||||||||||
Long time ago, I wondered how Microsoft Access put an Edit control on the context menu! Then I got another idea ... why don't we use any control(s) on the context menu? This will make the user interface easier to use, learn and increase productivity. The good news here is that, you can make it the same way you design a user control or a form using the Visual Studio designer.
At first, I thought we could customize the Menu. Then I discovered that this is very hard and maybe impossible. I tried to make use of the Form, but this is not the right choice because when we show it, the parent form loses its focus. A context menu shouldn't cause that. Luckily, I found the very good article "Simple Pop-up Control" by Lukasz Swiatkowski. This article shows how to display a pop up control using the ToolStripDropDown class. Then I said, "I found it." I used that idea to make my idea: a context menu that contains any group of controls.
Internally SuperContextMenu uses another class PopItUp which based on ToolStripDropDown which is responsible to show the user control as a pop up control.
UserControl to NewInterfaceGuides.SuperContextMenu. InitializeComponent() initialize it and add event handlers to the controls. ShowAsContextMenu() method Close() method. I still have these bugs but I am working on them so if you have an idea how to solve these bugs, please, help me.
System.Windows.Forms.ComboBox class behaves in a strange way. It closes the container when the user clicks on the part of the combo box's dropdown list that sticks out of the container area. So, make sure that the dropdown list is totally inside the area.
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 11 Jun 2008 Editor: Sean Ewington |
Copyright 2008 by Hany Badrous Everything else Copyright © CodeProject, 1999-2009 Web18 | Advertise on the Code Project |