How do menu shortcuts work?

The focused control’s ProcessCmdKey will be called first. 1) The Control class implementation of this method will check if there is a ContextMenu associated with the Control and if so let the context menu handle the shortcut. 2) If not handled, the ProcessCmdKey of the parent will be called recursively until the Form is reached. 3) When the Form is reached it’s MainMenu will be requested to handle the key. You can override ProcessCmdKey of any Control and interrupt the normal processing. Note that you can also override the ProcessCmdKey method is the MainMenu and ContextMenu classes (this is not documented) to override default processing.

How do I make the context menu appear only when clicked at certain portions of the Control?

You can listen to the Popup event, determine where the mouse was clicked and selectively make the menu items visible in the menu as follows: // In C# private void contextMenu1_Popup(object sender, System.EventArgs e) { // Get current mouse click position in the control (assuming pictureBox1 is the control): Point ptClick = this.pictureBox1.PointToClient(Control.MousePosition); // Get the rectangle where you want to show the context menu. Rectangle preferredClickRect = new Rectangle(0, 0, 50, 50); if(preferredClickRect.Contains(ptClick)) { // Show all the menu items so that the menu will appear foreach(MenuItem item in this.contextMenu1.MenuItems) item.Visible = true; } else { // Hide all the menu items so that the menu will not appear foreach(MenuItem item in this.contextMenu1.MenuItems) item.Visible = false; } } ’ In VB.Net Private Sub contextMenu1_Popup(ByVal sender As Object, ByVal e As System.EventArgs) ’ Get current mouse click position in the control (assuming pictureBox1 is the control): Dim ptClick As Point = Me.pictureBox1.PointToClient(Control.MousePosition) ’ Get the rectangle where you want to show the context menu. Dim preferredClickRect As Rectangle = New Rectangle(0,0,50,50) If preferredClickRect.Contains(ptClick) Then ’ Show all the menu items so that the menu will appear Dim item As MenuItem For Each item In Me.contextMenu1.MenuItems item.Visible = True Next Else ’ Hide all the menu items so that the menu will not appear Dim item As MenuItem For Each item In Me.contextMenu1.MenuItems item.Visible = False Next End If End Sub

What are some common gotchas while trying to embed a Windows Forms Control in IE?

The issues listed here are pertaining to code running in IE in the default Internet Zone. 1) You cannot view Controls inside IE using the 1.0 framework (when running with the permissions in the default Internet Zone). This is however possible with the 1.1 (Everett) framework. 2) Use only one . in the assembly file name and ‘Assembly Name'(in Project Properties Dialog). For example, ‘Syncfusion.Shared.dll’ is an invalid dll name, but ‘Shared.dll’ is valid. 3) Signed assemblies couldn’t be loaded.