Category / Section
How to display the MiniToolBar and ContextMenu controls at the same time?
1 min read
Show MiniToolBar and ContextMenuStripEx
You can show the MiniToolBar and ContextMenuStripEx at the same by following the below steps.
1)Need to show the ContextMenuStripEx, on MouseDown event.
2)Need to update the visibility of MiniToolBar in required location.
3)Need to enable the visibility of the MiniToolBar, in “Opened” event in ContextMenuStripEx.
The following code example demonstrates the same.
C#
void richTextBox1_MouseDown(object sender, MouseEventArgs e) { //To show the context Menu this.contextMenuStripEx1.Show(Cursor.Position); //To hide the MiniToolBar this.miniToolBar1.Visible = false; //To show the MiniToolBar with specified location. this.miniToolBar1.Show(PointToScreen(e.Location), ToolStripDropDownDirection.AboveLeft); } void contextMenuStripEx1_Opened(object sender, EventArgs e) { //To show the MiniToolBar this.miniToolBar1.Visible = true; }
VB
Private Sub richTextBox1_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs) 'To show the context Menu Me.contextMenuStripEx1.Show(Cursor.Position) 'To hide the MiniToolBar Me.miniToolBar1.Visible = False 'To show the MiniToolBar with specified location. Me.miniToolBar1.Show(PointToScreen(e.Location), ToolStripDropDownDirection.AboveLeft) End Sub Private Sub contextMenuStripEx1_Opened(ByVal sender As Object, ByVal e As EventArgs) 'To show the MiniToolBar Me.miniToolBar1.Visible = True End Sub
Figure 1. MiniToolBar and ContextMenuStripEx shows on same time.
Samples: