471,348 Members | 1,325 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,348 software developers and data experts.

Context menu and TabControl question

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!

--
WWW: http://hardywang.1accesshost.com
ICQ: 3359839
yours Hardy
Jan 9 '06 #1
1 4837
http://www.dotnetrix.co.uk/tabcontrols.html --> Associate a ContextMenu with
the TabItem headers of a Tabcontrol.

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"Hardy Wang" <ha*******@newsgroups.nospam> wrote in message
news:uF****************@TK2MSFTNGP14.phx.gbl...
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!

--
WWW: http://hardywang.1accesshost.com
ICQ: 3359839
yours Hardy

Jan 9 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Eddie de Bear | last post: by
4 posts views Thread by Mohit Gupta | last post: by
4 posts views Thread by Aaron Queenan | last post: by
8 posts views Thread by Dennis C. Drumm | last post: by
13 posts views Thread by Steven Smith | last post: by
1 post views Thread by Chris Murphy via DotNetMonster.com | last post: by
reply views Thread by Graeme M via DotNetMonster.com | last post: by
2 posts views Thread by jamil | last post: by

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.