Category / Section
How to customize MainMenu ToolBar in the WinForms MainFrameBarManager?
2 mins read
Customize the MainFrameBarManager
In the MainFrameBarManager, the background of the MainManu ToolBar can be customized by handling the DrawBackground event. The following code example demonstrates the same.
C#
//Draws the background of the MainMenu ToolBar. this.mainFrameBarManager1.MainMenuBar.DrawBackground += new PaintEventHandler(MainMenuBar_DrawBackground); void MainMenuBar_DrawBackground(object sender, PaintEventArgs e) { //Gets the MainframeBarManager items bound. Rectangle rect = e.ClipRectangle; //Fills the rectangle. e.Graphics.FillRectangle(Brushes.Pink, rect); }
VB
'Draws the background of the MainMenu ToolBar. AddHandler mainFrameBarManager1.MainMenuBar.DrawBackground, AddressOf MainMenuBar_DrawBackground Private Sub MainMenuBar_DrawBackground(ByVal sender As Object, ByVal e As PaintEventArgs) 'Gets the MainframeBarManager items bound. Dim rect As Rectangle = e.ClipRectangle 'Fills the rectangle. e.Graphics.FillRectangle(Brushes.Pink, rect) End Sub
Note:
The above solution is not applicable for Default, OfficeXP and Metro visual style in the MainFrameBarManager.
The following screenshot displays the Customized MainFrameBar Manager.
Figure 1: Customized MainFrameBar Manager
Sample: https://www.syncfusion.com/downloads/support/directtrac/general/MainFrameManager_VB1582033944.zip