Articles in this section
Category / Section

How to load custom controls in MiniToolBar?

1 min read

Load custom controls

You can load custom controls in MiniToolBar by following the steps.

1)Need to add the ToolStripPanelItem in MiniToolBar Items Collection Editor, as shown in below image.

 

Item Collection Editor for MiniToolBar

Figure 1. Item Collection Editor for MiniToolBar.

2)Need to host Custom control as ToolStripItem and add it in ToolStripPanelItem.

3)Need to add the ToolStripPanelItem in MiniToolBar.

4)Specify the associated control for MiniToolBar.

 

The following code example demonstrates the same.

C#

//Initialize the ToolStripPanelItem
Syncfusion.Windows.Forms.Tools.ToolStripPanelItem toolStripPanelItem1 = new Syncfusion.Windows.Forms.Tools.ToolStripPanelItem();
 
//To add the ToolStripPanelItem in MiniToolBar
this.miniToolBar1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {this.toolStripPanelItem1});
 
//To load custom controls in MiniToolBar.
toolStripPanelItem1.Items.Add(new ToolStripControlHost(this.integerTextBox1));
 
//To load custom controls in MiniToolBar.
this.toolStripPanelItem1.Items.Add(new ToolStripControlHost(this.integerTextBox1));
//To specify the associated control with MiniToolBar
this.miniToolBar1.AssociatedControl = this.richTextBox1;

VB

'Initialize the ToolStripPanelItem
Dim toolStripPanelItem1 As Syncfusion.Windows.Forms.Tools.ToolStripPanelItem = New Syncfusion.Windows.Forms.Tools.ToolStripPanelItem
 
'To add the ToolStripPanelItem in MiniToolBar
Me.miniToolBar1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.toolStripPanelItem1})
 
'To load custom controls in MiniToolBar.
toolStripPanelItem1.Items.Add(New ToolStripControlHost(Me.integerTextBox1))
 
'To load custom controls in MiniToolBar.
Me.toolStripPanelItem1.Items.Add(New ToolStripControlHost(Me.integerTextBox1))
'To specify the associated control with MiniToolBar
Me.miniToolBar1.AssociatedControl = Me.richTextBox1

 

Custom controls loaded in MiniToolBar

Figure 2. Custom controls loaded in MiniToolBar.

Samples:

C#: MiniToolBar_CustomControl_C#

VB: MiniToolBar_CustomControl_VB

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied