|
Imports System
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Windows.Forms
Namespace Gui.Components
Friend Class TabStripMenuGlyph
Private glyphRect As Rectangle = Rectangle.Empty
Private m_isMouseOver As Boolean
Private renderer As ToolStripProfessionalRenderer
Friend Sub New(ByVal renderer As ToolStripProfessionalRenderer)
Me.renderer = renderer
End Sub
Public Sub DrawGlyph(ByVal g As Graphics)
If Me. m_isMouseOver Then
Dim buttonSelectedHighlight As Color = Me.renderer.ColorTable.ButtonSelectedHighlight
g.FillRectangle(New SolidBrush(buttonSelectedHighlight), Me.glyphRect)
Dim glyphRect As Rectangle = Me.glyphRect
glyphRect.Width -= 1
glyphRect.Height -= 1
g.DrawRectangle(SystemPens.Highlight, glyphRect)
End If
Dim smoothingMode As SmoothingMode = g.SmoothingMode
g.SmoothingMode = SmoothingMode.Default
Using pen As New Pen(Color.Black)
pen.Width = 2f
g.DrawLine(pen, New Point((Me.glyphRect.Left + (Me.glyphRect.Width \ 3)) - 2, (Me.glyphRect.Height \ 2) - 1), New Point(Me.glyphRect.Right - (Me.glyphRect.Width \ 3), (Me.glyphRect.Height \ 2) - 1))
End Using
Dim points() As Point = { New Point((Me.glyphRect.Left + (Me.glyphRect.Width \ 3)) - 2, (Me.glyphRect.Height \ 2) + 2), New Point(Me.glyphRect.Right - (Me.glyphRect.Width \ 3), (Me.glyphRect.Height \ 2) + 2), New Point((Me.glyphRect.Left + (Me.glyphRect.Width \ 2)) - 1, Me.glyphRect.Bottom - 4) }
g.FillPolygon(Brushes.Black, points)
g.SmoothingMode = smoothingMode
End Sub
Public Property Bounds() As Rectangle
Get
Return Me.glyphRect
End Get
Set(ByVal value As Rectangle)
Me.glyphRect = value
End Set
End Property
Public Property IsMouseOver() As Boolean
Get
Return Me. m_isMouseOver
End Get
Set(ByVal value As Boolean)
Me. m_isMouseOver = value
End Set
End Property
End Class
End Namespace
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
MS, BBA, software developer, consultant, and trainer. Specializing in building data-centric applications designed for business, university, community & faith based organizations. Started developing Excel VBA macros and never looked back. Freelance developer utilizing VB.Net, SQL Server, Microsoft Access, and ASP.Net.