Private Sub Process_ToolClick_Events_Load(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles MyBase.Load Dim frm As New ProcessingToolClickChildForm() frm.MdiParent = Me frm.Show() End Sub
This topic demonstrates how to process ToolClick events for a tool on an MDI child form. Even though an MDI child form’s toolbars and tools can be set to merge into the MDI parent form’s toolbars, the ToolClick events for tools that originated from the child will be fired on the MDI child UltraToolBarsManager. This is advantageous since it allows you to encapsulate all processing for child tools directly on the child form. This sample can be followed to see this behavior.
Set the IsMdiContainer property of your parent form to True.
Add an MDI child form called ProcessingToolClickChildForm to your project.
Add the UltraToolBarsManager to each of these forms.
Add some tools to the UltraToolBarsManager of the MDI parent and the MDI child form.
Add the following code to show the MDI child form in the MDI parent.
In Visual Basic:
Private Sub Process_ToolClick_Events_Load(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles MyBase.Load Dim frm As New ProcessingToolClickChildForm() frm.MdiParent = Me frm.Show() End Sub
In C#:
private void Process_ToolClick_Events_Load( object sender, EventArgs e) { ProcessingToolClickChildForm frm = new ProcessingToolClickChildForm(); frm.MdiParent = this; frm.Show(); }
Add a ToolClick event handler to the MDI child’s UltraToolBarsManager.
For example, the following code sets text to a TextBox that is on ProcessingToolClickChildForm when a button tool is clicked. The button has already been added to Toolbar in the design-time customizer.
In Visual Basic:
Private Sub UltraToolbarsManager1_ToolClick(ByVal sender As Object, _ ByVal e As Infragistics.Win.UltraWinToolbars.ToolClickEventArgs) _ Handles UltraToolbarsManager1.ToolClick If e.Tool.Key = "Infragistics" Then TextBox1.Text = "Infragistics" End If End Sub
In C#:
private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e) { if(e.Tool.Key == "Infragistics") textBox1.Text = "Infragistics"; }