We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Context Menu For TabPage Header

Hi,

How do I implement a ContextMenu (Syncfusion''s or WinForm''s) that only pops up when right clicking the TabPage Header , not the TabPage itself like in VS2003/2005.

Cheers





1 Reply

MJ Mano J Syncfusion Team July 20, 2006 02:47 PM UTC

Hi Max,

Thanks for using Essential Tools.

You have to get selected tab header bounds using GetTabRect method and show the winforms context menu if the mouse up occurs inside the tab rect.

private void tabControlAdv1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
Rectangle rect = this.tabControlAdv1.GetTabRect(this.tabControlAdv1.SelectedIndex);
Point pt = new Point(e.X ,e.Y);
if(rect.Contains(pt))
{
this.contextMenu1.Show(this.tabControlAdv1, pt);
}
}

I have attached a sample. Please refer to it and let me know if this helps you.

Regards,
Mano

Sample_tabControlAdv.zip

Loader.
Live Chat Icon For mobile
Up arrow icon