-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCustomSystemRenderer.cs
44 lines (41 loc) · 1.52 KB
/
CustomSystemRenderer.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
namespace CustomBrowser
{
using System.Drawing;
using System.Windows.Forms;
/// <summary>
/// This custom renderer removes the white border that Microsoft doesn't let us control and controls various styling options for the toolbar.
/// </summary>
public class CustomSystemRenderer: ToolStripSystemRenderer
{
/// <summary>
/// Simply overrides the ToolStripBorder
/// </summary>
/// <param name="e">Event Arguments</param>
protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e)
{
// base.OnRenderToolStripBorder(e);
}
protected override void OnRenderButtonBackground(ToolStripItemRenderEventArgs e)
{
if (!e.Item.Selected)
{
base.OnRenderButtonBackground(e);
}
else
{
Rectangle rectangle = new Rectangle(0, 0, e.Item.Size.Width - 1, e.Item.Size.Height - 1);
switch (e.Item.Name)
{
case "CloseWindowButton":
e.Graphics.FillRectangle(Brushes.DarkOrchid, rectangle);
e.Graphics.DrawRectangle(Pens.DarkOrchid, rectangle);
break;
default:
e.Graphics.FillRectangle(Brushes.Green, rectangle);
e.Graphics.DrawRectangle(Pens.Olive, rectangle);
break;
}
}
}
}
}