All types deriving from System.Windows.Forms.Control have a ContextMenu property. Setting it up should be pretty straight forward:
$contextMenu = New-Object System.Windows.Forms.ContextMenu # Create context menu
$menuItem1 = New-Object System.Windows.Forms.MenuItem -ArgumentList "Hello"
$menuItem2 = New-Object System.Windows.Forms.MenuItem -ArgumentList "Hello Again"
$contextMenu.MenuItems.Add($menuItem1) # Add option to context menu
$contextMenu.MenuItems.Add($menuItem2)
$textBox.ContextMenu = $contextMenu # Assuming you've assigned your TextBox instance to $textBox
As for the event handler, I'm not entirely sure about that, but looking at this blog:
http://blogs.msdn.com/powershell/ar...vents.aspx ... it looks like it's done this way:
$menuItem1.Add_Click({ [System.Windows.Forms.MessageBox]::Show("Hello Clicked!") })
$menuItem2.Add_Click({ [System.Windows.Forms.MessageBox]::Show("Hello Again Clicked!") })