Can I use your program's source code for my program? Join now here: I want to contribute with a translation!Ĭlick this link and follow the guide. I also post my updates on Discord, to keep everyone up-to-date 24/7! Drag CustomContrls_MenuStrip to the form in the IDE and start using it.SonoSooS is currently rewriting it from scratch.Ī fully functional MIDI to WAV converter, for FREE! The control retains all the functions of the system menu control and adds an attribute to change the menu style. In this way, we have made our custom MenuStrip control. Renderer = new CustomProfessionalRenderer(_themeColor) Renderer = new CustomProfessionalRenderer(_themeColor) ġ5 this. So the main thing is to implement the class that defines the appearanceįirst create a class CustomProfessionalRenderer inherited from ġ // Rendering background Including menustrip background toolstripDropDown backgroundĢ protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e)Ħ g.SmoothingMode = SmoothingMode.HighQuality // Anti-aliasingĨ LinearGradientBrush lgbrush = new LinearGradientBrush( new Point( 0, 0 ), new Point( 0 , toolStrip.Height), Color.FromArgb( 255 ,Color.White), Color.FromArgb( 150 ,_color)) ġ1 // Defined by the Paint method of menuStrip No operation hereġ3 else if (toolStrip is ToolStripDropDown)ġ6 GraphicsPath path = new GraphicsPath() ġ7 Rectangle rect = new Rectangle(Point.Empty, toolStrip.Size) ġ8 Rectangle arcRect = new Rectangle(rect.Location, new Size(diameter, diameter)) ġ // The render item does not call the base class method with the same nameĢ protected override void OnRenderMenuItemBackground(ToolStripItemRenderEventArgs e)ġ2 LinearGradientBrush lgbrush = new LinearGradientBrush( new Point( 0, 0 ), new Point( 0 , item.Height), Color.FromArgb( 100 , Color.White), Color.FromArgb( 0 , Color.White)) ġ3 SolidBrush brush = new SolidBrush(Color.FromArgb( 255 ,Color.White)) ġ6 GraphicsPath gp = GetRoundedRectPath( new Rectangle( new Point( 0, 0 ), item.Size), 5 ) Ģ1 /// /Create a rectangular path with 2 rounded corners above and leftĢ2 // GraphicsPath path = new GraphicsPath() Ģ4 // Rectangle rect = new Rectangle(Point.Empty, item.Size) Ģ5 // Rectangle arcRect = new Rectangle(rect.Location, new Size(diameter, diameter)) ģ1 // path.AddLine(new Point(rect.Width, rect.Height), new Point(0, rect.Height)) ģ5 g.FillRectangle(Brushes.White, new Rectangle(Point.Empty,item.Size)) ģ9 else if (toolstrip is ToolStripDropDown)Ĥ1 g.SmoothingMode = SmoothingMode.HighQuality Ĥ2 LinearGradientBrush lgbrush = new LinearGradientBrush( new Point( 0, 0 ), new Point(item.Width, 0 ), Color.FromArgb( 200 , _color), Color.FromArgb( 0 , Color.White)) Ĥ5 GraphicsPath gp = GetRoundedRectPath( new Rectangle( 0, 0 , item.Width, item.Height), 10 ) ġ public partial class CustomContrls_MenuStrip : MenuStripģ private Color _themeColor = Color.Gray ħ this. We inherit this professional class and override some of its methods to customize the appearance. In order to reduce the workload, we don't have to inherit the abstract class ToolStripProfessionalRenderer, ToolStripProfessionalRenderer, which defines the appearance of the menu bar and toolbar. The ToolStripProfessionalRenderer class inherits from it. The system menu appearance is defined by the ToolStripProfessionalRenderer class. This class defines the appearance of the menu toolbar. This property accepts one Object of the class. Write some of these methods, realize the appearance changes, and see the effect: NET class library, so I integrate a dedicated class and pay attention to it. I can’t fully implement the abstract class that renders the menu appearance provided by the. I have seen such an article in the Programmer’s Window, but my level is limited, but I can’t achieve the beautification as he said. The articles are relatively simple but the effect is very good. The beautiful interface is always pleasing to the eye. (Please delete the content in brackets for reprinting)Ĭhange the appearance of MenuStrip so that it is no longer the default appearance of the system.
0 Comments
Leave a Reply. |