Articles in this section
Category / Section

How to customize MainMenu ToolBar in the WinForms MainFrameBarManager?

1 min 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.


//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); 


'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



The above solution is not applicable for Default, OfficeXP and Metro visual style in the MainFrameBarManager.


The following screenshot displays the Customized MainFrameBar Manager.

Customize the MainFrameBar manager

Figure 1: Customized MainFrameBar Manager


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