c# - toolStrip to have menuStrip gradient background -


i have form menu , toolstrip @ top. menustrip has nice looking gradient background, how can same effect on toolstrip control? know rendermode property changing doesn't have desired result.

toolstrip background

you can achieve custom renderer.

public class customtoolstriprenderer : toolstripprofessionalrenderer {     public customtoolstriprenderer() { }      protected override void onrendertoolstripbackground(toolstriprendereventargs e)     {         //you may want change based on toolstrip's dock or layout style         lineargradientmode mode = lineargradientmode.horizontal;          using (lineargradientbrush b = new lineargradientbrush(e.affectedbounds, colortable.menustripgradientbegin, colortable.menustripgradientend, mode))         {             e.graphics.fillrectangle(b, e.affectedbounds);         }     } } 

then set toolstrip use instance of renderer.

public form1() {     initializecomponent();      customtoolstriprenderer r = new customtoolstriprenderer();     r.roundededges = false;      toolstrip1.renderer = r; } 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -