473,586 Members | 2,681 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Context menu in Combo Control

I've created a class "MRP123MenuItem " derived from
inbuilt MenuItem class to give customized look and feel to
the user. I've created context menus for different
controls using mine MRP123MenuItem' s and it all works fine
except for ComboBox control. It only displays a strip of
context menus without any content. I'm unable to
understand why it is happening though it works fine when
used along with any other control.
Please help me out.

Nov 15 '05 #1
1 3567

-

I've created a class "MRP123MenuItem " derived from
inbuilt MenuItem class to give customized look and feel to
the user. I've created context menus for different
controls using mine MRP123MenuItem' s and it all works fine
except for ComboBox control. It only displays a strip of
context menus without any content. I'm unable to
understand why it is happening though it works fine when
used along with any other control.
Please help me out.

Not sure if i understand your problem correctly. Here is what I tried and
it worked for me in VS 2003. net

I had my own MenuItem class:

public class MyMenuItem : MenuItem
{
public MyMenuItem (string name):base (name)
{
}
}
and then in my combobox control i did the following:

this.comboBox1. Name = "comboBox1" ;
this.comboBox1. Size = new System.Drawing. Size(88, 21);
this.comboBox1. TabIndex = 0;
this.comboBox1. Text = "comboBox1" ;
this.comboBox1. Items.Add ("Hello");
this.comboBox1. Items.Add("Hi") ;
ContextMenu menu = new ContextMenu ();;
MyMenuItem menuItem1 = new MyMenuItem ("hello");
menu.MenuItems. Add ((MenuItem)menu Item1);
this.comboBox1. ContextMenu = menu;
Right clicking on this combobox returns to me my context menu.

Hope this helps you out.

--
Adrian Mascarenhas, Developer Division

This posting is provided "AS IS" with no warranties, and confers no rights.

Note: For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which they
originated.

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
14171
by: Aaron Queenan | last post by:
How can I use the designer to add a context menu to a class which inherits from a control, e.g. treeview, without adding the context menu to a form? For example, to add a context menu with "Select All" and "Clear Selection" to a checked list box? Thanks, Aaron Queenan.
5
5482
by: Dean L. Howen | last post by:
Dear friends, Could we determine when context menu should appear?
0
1372
by: allen | last post by:
If I create a control library control (and change the base control from usercontrol to control). Add that control to the toolbox, then add that control to a windows form. Then add a context menu to the control. Within the control, how do you tell when a context menu has been instanced? I don't see any overrides I can work with. Trapping...
0
1906
by: Andrew Baker | last post by:
Have a look at the code below. It's a really simple example where I have added two controls to a form, a textbox and a combo box. Both add owner drawn context menus to the controls, but the combobox will NOT draw custom drawn context menu item. I have tried EVERYTHING (deriving from MenuItem and even tried calling TrackPopupMenuEx directly),...
1
2709
by: Chris Murphy via DotNetMonster.com | last post by:
Hi all, I'm just wondering if any one can help me with this development issue I'm having. I've created a customized treeview control to handle the particular tasks to which I'll be using it. Within the control I'm dynamically creating a context menu and assigning it to the ContextMenu property of the control -- think of this like the default...
1
4465
by: stinehelferw | last post by:
I need a right-click menu on a form list control with combobox controls. I used View->Toolbars->Customize to create a toolbar. I added ComboBox through commands tab. I set properties to Popup making it a shortcut menu. I have no problem linking it to the list control. The menu comes up when I right-click the list control.
2
11673
by: Lucky | last post by:
hi guys, i'm working on the context menu for the controls. the problem i'm facing right now is like this : i want to use one context menu for more then one controls lets say i want to use one context menu for 3 treeview controls as 3 of them shares same type of menu. what i'm not able to do is, i can not idetify which control has invoke the...
2
5898
by: MCM | last post by:
I'm working on a plotting control. The plotting control will have a context menu with basic commands for "scaling", "zooming", etc. Is there a way that, from the parent form, I can add more commands to the control's context menu? I'm envisioning a case where the control has a set of context menu items, and the parent form also has a set...
4
5618
by: PW | last post by:
Hi, What is one and does Access 2003 have one? Or how would I create one? I would like the user to be able to right-click on a form or a control on a form and have a menu that offers to go to a reservation, client, activity, etc.... maybe even print something. Thanks, -paulw
0
7912
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7839
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8202
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8338
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8216
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6614
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3837
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
1180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.