ContextMenu: lock to one gridview (on tabcontrol page) + hide items
Posted: Thu Jan 23, 2020 11:57 am
Hi,
I have a Powershell Studio Form with tabcontrol in the main form.
In the tabcontrol there are several different gridviews (every tab -3 tabs- has one). On one of these gridviews there is a contextmenustrip active, which works fine.
No I needed another contextmenustrip for another gridview in another tab and saw that my contextmenustrip is active wherever I click in the form instead of locked to 1 gridview.
My question:
-how can I lock the contextmenu to 1 gridview in 1 tab (it should only appear there when rightclicking an item in that gridview)?
-how can I add another contextmenu that is 'locked' (appears only) on another gridview (other tab)
-can I hide specifc contexmenuitems for specific users if ($env:username) –eq .. then remove item or disable?
Note: I'm already hiding tabs using $Mytab = $tabcontrolMainForm.TabPages['Mytab']
if ... {$tabcontrolMainForm.TabPages.Remove($Mytab )} which works fine. Is there a similar approach to hide contextmenuitems?
Thanks!
J.
I have a Powershell Studio Form with tabcontrol in the main form.
In the tabcontrol there are several different gridviews (every tab -3 tabs- has one). On one of these gridviews there is a contextmenustrip active, which works fine.
No I needed another contextmenustrip for another gridview in another tab and saw that my contextmenustrip is active wherever I click in the form instead of locked to 1 gridview.
My question:
-how can I lock the contextmenu to 1 gridview in 1 tab (it should only appear there when rightclicking an item in that gridview)?
-how can I add another contextmenu that is 'locked' (appears only) on another gridview (other tab)
-can I hide specifc contexmenuitems for specific users if ($env:username) –eq .. then remove item or disable?
Note: I'm already hiding tabs using $Mytab = $tabcontrolMainForm.TabPages['Mytab']
if ... {$tabcontrolMainForm.TabPages.Remove($Mytab )} which works fine. Is there a similar approach to hide contextmenuitems?
Thanks!
J.