1 #Region "Microsoft.VisualBasic::95df594ce3dd353029808477ecffa3ec, Microsoft.VisualBasic.Core\ApplicationServices\Tools\WinForm\ChromeUIRender.vb"
2
3     ' Author:
4     
5     '       asuka (amethyst.asuka@gcmodeller.org)
6     '       xie (genetics@smrucc.org)
7     '       xieguigang (xie.guigang@live.com)
8     
9     ' Copyright (c) 2018 GPL3 Licensed
10     
11     
12     ' GNU GENERAL PUBLIC LICENSE (GPL3)
13     
14     
15     ' This program is free software: you can redistribute it and/or modify
16     ' it under the terms of the GNU General Public License as published by
17     ' the Free Software Foundation, either version 3 of the License, or
18     ' (at your option) any later version.
19     
20     ' This program is distributed in the hope that it will be useful,
21     ' but WITHOUT ANY WARRANTY; without even the implied warranty of
22     ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23     ' GNU General Public License for more details.
24     
25     ' You should have received a copy of the GNU General Public License
26     ' along with this program. If not, see <http://www.gnu.org/licenses/>.
27
28
29
30     ' /********************************************************************************/
31
32     ' Summaries:
33
34     '     Class ChromeUIRender
35     
36     '         SubOnRenderMenuItemBackground, OnRenderSeparator
37     
38     
39     ' /********************************************************************************/
40
41 #End Region
42
43 Imports System.Drawing
44
45 Namespace Windows.Forms
46
47     Public Class ChromeUIRender : Inherits ToolStripSystemRenderer
48
49         ''' <summary>
50         ''' Draw MenuItem Background of MBMenuStrip
51         ''' </summary>
52         Protected Overrides Sub OnRenderMenuItemBackground(e As ToolStripItemRenderEventArgs)
53             Dim g As Graphics = e.Graphics
54             Dim rect As New Rectangle With {
55                 .Location = New Point,
56                 .Size = e.Item.Size
57             }
58
59             If e.Item.Selected Then
60                 g.FillRectangle(__chromeMenuSelected, rect)
61             Else
62                 g.FillRectangle(Brushes.White, rect)
63             End If
64         End Sub
65
66         ReadOnly __chromeMenuSelected As New SolidBrush(Color.FromArgb(66, 129, 244))
67         ReadOnly __chromeSeperator As New Pen(New SolidBrush(Color.FromArgb(233, 233, 233)), 1)
68
69         Protected Overrides Sub OnRenderSeparator(e As ToolStripSeparatorRenderEventArgs)
70             Dim h As Integer = e.Item.Height / 2
71             Dim layout As New Rectangle With {
72                 .Location = New Point,
73                 .Size = New Size With {
74                     .Width = e.ToolStrip.Width,
75                     .Height = e.Item.Height
76                 }
77             }
78             Dim pa As New Point(0, h)
79             Dim pb As New Point With {
80                 .X = e.ToolStrip.Width,
81                 .Y = h
82             }
83
84             e.Graphics.FillRectangle(Brushes.White, layout)
85             e.Graphics.DrawLine(__chromeSeperator, pa, pb)
86         End Sub
87     End Class
88 End Namespace