Posted 28 July 2021, 1:15 pm EST
I am currently using an iShape object. Unlike RectangleShape, Contextmenu is displayed even if I don’t set it up.
I’d like to modify this context menu. How do I add some menus or make some menus invisible?
Forums Home / Spread / Spread for WinForms
Posted by: gw.noh on 28 July 2021, 1:15 pm EST
Posted 28 July 2021, 1:15 pm EST
I am currently using an iShape object. Unlike RectangleShape, Contextmenu is displayed even if I don’t set it up.
I’d like to modify this context menu. How do I add some menus or make some menus invisible?
Posted 28 July 2021, 1:19 pm EST - Updated 30 September 2022, 4:18 am EST
Here’s the image.
Posted 28 July 2021, 4:20 pm EST
Hi,
You can use the BeforeRightClick event for this.
Here’s a code snippet to add a new menu item:
fpSpread1.BeforeRightClick += FpSpread1_BeforeRightClick;
private void FpSpread1_BeforeRightClick(object sender, FarPoint.Win.Spread.BeforeRightClickEventArgs e)
{
if (e.ContextMenuType == FarPoint.Win.Spread.ContextMenuType.Shape)
{
e.ContextMenuStrip.Items.Add("New Menu Item", image, clickHandler);
}
}
Regards,
Jitender
Posted 28 July 2021, 7:05 pm EST
Thank you for the great solution.