PDA

Click to See Complete Forum and Search --> : [2.0] ContextMenu on a TabPage


nebulom
Jun 5th, 2007, 09:39 PM
Maybe I'm missing something... Is there a way I can setup a ContextMenu on a TabPage and not on the TabControl?

Thanks.

jmcilhinney
Jun 5th, 2007, 11:36 PM
That depends on exactly what you mean. The TabControl has a ContextMenuStrip property, as does each TabPage. You can assign a menu to that property of each page and when you right-click a page that menu will be displayed.

Having said that, it is important to note that the tabs displayed along the top of the control are NOT part of the TabPages, so if you right-click one of them you'll see the TabControl's ContextMenuStrip.

If you don't want that behaviour then you'll have to change it yourself. You'd have to determine which tab was clicked using the sizes of the tabs and the mouse coordinates, then display your preferred menu manually.