|
Imports System.Windows.Forms
Imports System.Drawing
Imports System.ComponentModel
Imports ggCoreLib
<DesignTimeVisible(False), _
Designer("BVToolBarButtonDesigner"), _
CLSCompliant(True)> _
Public Class BVToolBarButton
Inherits BVToolBarObjectBase
Protected intDropDownMenu As System.Windows.Forms.Menu
Protected intImageIndex As Integer
Protected intPushedImageIndex As Integer
Protected intPartialPush As Boolean
Protected intPushed As Boolean
Protected intStyle As System.Windows.Forms.ToolBarButtonStyle
Protected intText As String
Protected intToolTipText As String
Protected Shared intId As Identificable
Protected intIdint As Integer
Public Sub New()
'Me.Name = "BVToolBarButton" & Rnd().ToString
Initialize()
Me.intName = Me.GetType.ToString & intIdint 'intId.Count(Me.GetType.ToString)
End Sub
Public Sub New(ByVal Name As String)
MyBase.New()
Me.Name = Name
Initialize()
End Sub
Protected Overrides Sub Initialize()
'If intId Is Nothing Then
'End If
intId = New Identificable(Me.GetType.ToString)
intIdint = Identificable.Count(Me.GetType.ToString)
intImageIndex = -1 '0
Me.intPushedImageIndex = -1 '0
intPartialPush = False
intStyle = ToolBarButtonStyle.PushButton
intPushed = False
intEnabled = True
MyBase.intVisible = True
intRec = New Rectangle(0, 0, 30, 30)
intBrush = New SolidBrush(Color.Gray)
End Sub
#Region "Properties"
Public Property DropDownMenu() As System.Windows.Forms.Menu
Get
Return intDropDownMenu
End Get
Set(ByVal Value As System.Windows.Forms.Menu)
intDropDownMenu = Value
End Set
End Property
Public Property ImageIndex() As Integer
Get
Return intImageIndex
End Get
Set(ByVal Value As Integer)
If intImageIndex <> Value Then
intImageIndex = Value
If Not Me.intParent Is Nothing Then
Me.intParent.Refresh()
End If
End If
End Set
End Property
Public Property PushedImageIndex() As Integer
Get
Return intPushedImageIndex
End Get
Set(ByVal Value As Integer)
If intPushedImageIndex <> Value Then
intPushedImageIndex = Value
If Not Me.intParent Is Nothing Then
Me.intParent.Refresh()
End If
End If
End Set
End Property
Public Property PartialPush() As Boolean
Get
Return intPartialPush
End Get
Set(ByVal Value As Boolean)
intPartialPush = Value
End Set
End Property
Public Property Pushed() As Boolean
Get
Return intPushed
End Get
Set(ByVal Value As Boolean)
If intPushed <> Value Then
intPushed = Value
If Not Me.intParent Is Nothing Then
Me.intParent.Refresh()
End If
End If
End Set
End Property
Public Property Style() As System.Windows.Forms.ToolBarButtonStyle
Get
Return intStyle
End Get
Set(ByVal Value As System.Windows.Forms.ToolBarButtonStyle)
If intStyle <> Value Then
intStyle = Value
If Not Me.intParent Is Nothing Then
Me.intParent.Refresh()
End If
End If
End Set
End Property
<Browsable(False)> _
Public ReadOnly Property Index() As Integer
Get
Return intIdint
End Get
End Property
Public Property Text() As String
Get
Return intText
End Get
Set(ByVal Value As String)
intText = Value
End Set
End Property
Public Property ToolTipText() As String
Get
Return intToolTipText
End Get
Set(ByVal Value As String)
intToolTipText = Value
End Set
End Property
<Browsable(False)> _
Public Overrides Property Location() As Point
Get
Return Me.intRec.Location
End Get
Set(ByVal Value As Point)
Me.intRec.Location = Value
End Set
End Property
'<Browsable(False)> _
' Public ReadOnly Property DropDownRectangle() As Rectangle
' Get
' If Me.intStyle = ToolBarButtonStyle.DropDownButton Then
' 'Return new Rectangle(Me.intRec.Right-me.intParent.ButtonSize.Width,me.intRec.Y,
' End If
' Return Me.intRec
' End Get
'End Property
<Browsable(False)> _
Public ReadOnly Property Width() As Integer
Get
Return Me.intRec.Width
End Get
End Property
<Browsable(False)> _
Public ReadOnly Property Height() As Integer
Get
Return Me.intRec.Height
End Get
End Property
#End Region
Public Overrides Sub Redraw(ByVal sender As Object, ByVal P As PaintEventArgs)
'P.Graphics.FillRectangle(intBrush, intRec)
If Me.intEnabled Then
ControlPaint.DrawButton(P.Graphics, intRec, ButtonState.All)
Else
ControlPaint.DrawButton(P.Graphics, intRec, ButtonState.Inactive)
End If
'ControlPaint.DrawBorder(P.Graphics, intRec, Color.Gray, ButtonBorderStyle.Dashed) ' ButtonState.All)
End Sub
End Class
|
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.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.