Private Declare Function CreateRectRgnIndirect Lib "GDI32" (lpRect As Rect) As Long
Private Declare Function DeleteObject Lib "GDI32" (ByVal hMF As Long) As Long
Private Declare Function RestoreDC Lib "GDI32" (ByVal hDC As Long, ByVal SavedDC As Long) As Long
Private Declare Function SaveDC Lib "GDI32" (ByVal hDC As Long) As Long
Private Declare Function SelectClipRgn Lib "GDI32" (ByVal hDC As Long, ByVal hRgn As Long) As Long
Public Property Let ButtonHeight(ByVal NewButtonHeight As Long)
m_ButtonHeight = NewButtonHeight
End Property
Public Property Set Cache(ByRef NewCache As PictureBox)
Set picCache = NewCache
End Property
Public Property Get Caption() As String
Caption = m_Caption
End Property
Public Property Let Caption(ByVal NewCaption As String)
m_Caption = NewCaption
End Property
Public Property Get Icon() As StdPicture
Set Icon = picIcon
End Property
Public Property Set Icon(ByRef NewIcon As StdPicture)
Set picIcon = NewIcon
End Property
Public Property Get Index() As Integer
Index = m_Index
End Property
Public Property Let Index(ByVal NewIndex As Integer)
m_Index = NewIndex
End Property
Public Property Let ItemAlignment(ByVal NewItemAlignment As AlignmentConstants)
m_ItemAlignement = NewItemAlignment
End Property
Public Property Let ItemForeColor(ByVal NewItemForeColor As Long)
m_ItemForeColor = NewItemForeColor
End Property
Public Property Get ItemType() As ItemTypes
ItemType = m_ItemType
End Property
Public Property Let ItemType(ByVal NewItemType As ItemTypes)
m_ItemType = NewItemType
End Property
Public Property Get ItemValue() As Boolean
ItemValue = m_ItemValue
End Property
Public Property Let ItemValue(ByVal NewItemValue As Boolean)
m_ItemValue = NewItemValue
If Not NewItemValue Then Call DrawBorder(DEFAULT)
End Property
Public Property Get Key() As String
Key = m_Key
End Property
Public Property Let Key(ByVal NewKey As String)
m_Key = NewKey
End Property
Public Property Set Parent(ByRef NewParent As PictureBox)
Set picMenu = NewParent
End Property
Public Property Let State(ByVal NewState As Long)
m_ButtonStruct.State = NewState
End Property
Public Property Get Tag() As String
Tag = m_Tag
End Property
Public Property Let Tag(ByVal NewTag As String)
m_Tag = NewTag
End Property
Public Property Get ToolTipText() As String
ToolTipText = m_ToolTipText
End Property
Public Property Let ToolTipText(ByVal NewToolTipText As String)
m_ToolTipText = NewToolTipText
End Property
Public Function DisableButton()
m_ButtonStruct.OnScreen = False
End Function
Public Function HitTest(ByVal MousePosition As Long, ByVal X As Long, ByVal Y As Long) As Boolean
If Not m_ButtonStruct.OnScreen Then Exit Function
If PtInRect(HitBorder, X, Y) Then
HitTest = True
If MousePosition = MOUSE_UP Then
If m_ItemValue Then
Call DrawBorder(SUNKEN)
ElseIf m_ButtonStruct.State <> RAISED Then
If (m_ItemType <> CheckButton) And (m_ItemType <> OptionButton) Then Call DrawBorder(RAISED)
End If
ButtonDownOnMe = False
ElseIf MousePosition = MOUSE_DOWN Then
If m_ButtonStruct.State = DEFAULT Then
If Not m_ItemValue Then Call DrawBorder(RAISED)
ElseIf m_ButtonStruct.State <> SUNKEN Then
Call DrawBorder(SUNKEN)
ButtonDownOnMe = True
End If
' MOUSE_CHECK or MOUSE_MOVE
ElseIf Not m_ItemValue Then
ButtonDownOnMe = False
If m_ButtonStruct.State = DEFAULT Then Call DrawBorder(RAISED)
End If
Else
If MousePosition <> MOUSE_MOVE Then ButtonDownOnMe = False
If Not m_ItemValue And (m_ButtonStruct.State <> DEFAULT) Then Call DrawBorder(DEFAULT)
End If
End Function
Public Function PaintButton(ByVal TopMenuItem As Integer, ByVal FirstIcon As Long, ByVal CurrentMenu As Integer, ByVal ClipHeight As Long, ByVal ItemIconSize As Integer, ByVal OnlyFullItemsShow As Boolean, ByVal OnlyFullItemsHit As Boolean, ByVal ButtonHideInSingleMenu As Boolean, ByRef IsShowed As Boolean) As Boolean