Context menu and TabControl question

H

Hardy Wang

Hi all,
I have a TabControl in my WinForm, I programmatically all tabs to this
control, and add some other controls to each tab. I would also like to set a
context menu to each tab, BUT what I need is right-click on each tab
name/text to popup the menu, when user right clicks the TabPage area (this
is the place holder for my other controls), nothing should happen.
Is there a way I can do it? My current code is

TabPage tp = new TabPage("Tab Name");
tp.ContextMenu = contextTabPage;
tabCtrl.TabPages.Add(tp);
MyControl mc = new MyControl();
tp.Controls.Add(,c);
mc.Show();
tabCtrl.SelectedTab = tp;

But this would enable context menu only within TabPage area, if I
right-click tab name, nothing happens.

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top