📄 candybutton.ctl
字号:
Exit Property
Handler:
End Property
Public Property Let ColorScheme(newValue As eColorScheme)
Select Case newValue
Case Aqua
ColorButtonUp = &HD06720
ColorButtonHover = &HE99950
ColorButtonDown = &HA06710
ColorBright = &HFFEDB0
Case WMP10
ColorButtonUp = &HD09060
ColorButtonHover = &HE06000
ColorButtonDown = &HA98050
ColorBright = &HFFFAFA
Case DeepBlue
ColorButtonUp = &H800000
ColorButtonHover = &HA00000
ColorButtonDown = &HF00000
ColorBright = &HFF0000
Case DeepRed
ColorButtonUp = &H80&
ColorButtonHover = &HA0&
ColorButtonDown = &HF0&
ColorBright = &HFF&
Case DeepGreen
ColorButtonUp = &H8000&
ColorButtonHover = &HA000&
ColorButtonDown = &HC000&
ColorBright = &HFF00&
Case DeepYellow
ColorButtonUp = &H8080&
ColorButtonHover = &HA0A0&
ColorButtonDown = &HC0C0&
ColorBright = &HFFFF&
End Select
m_ColorScheme = newValue
PropertyChanged "m_ColorScheme"
DrawButton (eNormal)
End Property
Public Property Get ColorScheme() As eColorScheme
ColorScheme = m_ColorScheme
End Property
Public Property Let BorderBrightness(newValue As Long)
m_BorderBrightness = SetBound(newValue, -100, 100)
PropertyChanged "m_BorderBrightness"
DrawButton (eNormal)
End Property
Public Property Get BorderBrightness() As Long
BorderBrightness = m_BorderBrightness
End Property
'/*** enable icon mouse over highliting
Public Property Get IconHighLite() As Boolean
IconHighLite = m_bIconHighLite
End Property
Public Property Let IconHighLite(PropVal As Boolean)
m_bIconHighLite = PropVal
PropertyChanged "IconHighLite"
End Property
'/*** enable icon mouse over highliting
Public Property Get IconHighLiteColor() As OLE_COLOR
IconHighLiteColor = m_lIconHighLiteColor
End Property
Public Property Let IconHighLiteColor(PropVal As OLE_COLOR)
m_lIconHighLiteColor = PropVal
PropertyChanged "IconHighLiteColor"
End Property
'/*** enable caption mouse over highliting
Public Property Get CaptionHighLite() As Boolean
CaptionHighLite = m_bCaptionHighLite
End Property
Public Property Let CaptionHighLite(PropVal As Boolean)
m_bCaptionHighLite = PropVal
PropertyChanged "CaptionHighLite"
End Property
Public Property Get CaptionHighLiteColor() As OLE_COLOR
CaptionHighLiteColor = m_lCaptionHighLiteColor
End Property
Public Property Let CaptionHighLiteColor(PropVal As OLE_COLOR)
m_lCaptionHighLiteColor = PropVal
PropertyChanged "CaptionHighLiteColor"
End Property
Public Property Let ColorBright(newValue As OLE_COLOR)
m_ColorBright = newValue
If m_ColorScheme <> Custom Then m_ColorScheme = Custom: PropertyChanged "m_ColorScheme"
PropertyChanged "m_ColorBright"
DrawButton (eNormal)
End Property
Public Property Get ColorBright() As OLE_COLOR
ColorBright = m_ColorBright
End Property
Public Property Let ColorButtonDown(newValue As OLE_COLOR)
m_ColorButtonDown = newValue
If m_ColorScheme <> Custom Then m_ColorScheme = Custom: PropertyChanged "m_ColorScheme"
PropertyChanged "m_ColorButtonDown"
DrawButton (eNormal)
End Property
Public Property Get ColorButtonDown() As OLE_COLOR
ColorButtonDown = m_ColorButtonDown
End Property
Public Property Let ColorButtonUp(newValue As OLE_COLOR)
m_ColorButtonUp = newValue
If m_ColorScheme <> Custom Then m_ColorScheme = Custom: PropertyChanged "m_ColorScheme"
PropertyChanged "m_ColorButtonUp"
DrawButton (eNormal)
End Property
Public Property Get ColorButtonUp() As OLE_COLOR
ColorButtonUp = m_ColorButtonUp
End Property
Public Property Let ColorButtonHover(newValue As OLE_COLOR)
m_ColorButtonHover = newValue
If m_ColorScheme <> Custom Then m_ColorScheme = Custom: PropertyChanged "m_ColorScheme"
PropertyChanged "m_ColorButtonHover"
DrawButton (eNormal)
End Property
Public Property Get ColorButtonHover() As OLE_COLOR
ColorButtonHover = m_ColorButtonHover
End Property
Public Property Let ForeColor(ByVal NewForeColor As OLE_COLOR)
m_ForeColor = NewForeColor
UserControl.ForeColor = m_ForeColor
PropertyChanged "ForeColor"
DrawButton (eNormal)
End Property
Public Property Get ForeColor() As OLE_COLOR
ForeColor = m_ForeColor
End Property
Public Property Set Picture(Value As StdPicture)
Set m_StdPicture = Value
PropertyChanged "Picture"
DrawButton (eNormal)
End Property
Public Property Get Picture() As StdPicture
Set Picture = m_StdPicture
End Property
Public Property Let Checked(Value As Boolean)
m_Checked = Value
If Value Then
DrawButton (eChecked)
Else
If IsHover Then
DrawButton (eHover)
Else
DrawButton (eNormal)
End If
End If
PropertyChanged "Checked"
End Property
Public Property Get Checked() As Boolean
Checked = m_Checked
End Property
Public Property Let Style(eVal As eStyle)
If eVal <> m_Style Then
m_Style = eVal
PropertyChanged "Style"
Init_Style
DrawButton (eNormal)
End If
End Property
Public Property Get Style() As eStyle
Style = m_Style
End Property
Public Property Let PictureAlignment(eVal As eAlignment)
If eVal <> m_PictureAlignment Then
m_PictureAlignment = eVal
PropertyChanged "PictureAlignment"
DrawButton (eNormal)
End If
End Property
Public Property Get PictureAlignment() As eAlignment
PictureAlignment = m_PictureAlignment
End Property
Public Property Let Caption(ByVal New_Caption As String)
m_Caption = New_Caption
PropertyChanged "Caption"
DrawButton (eNormal)
End Property
Public Property Get Caption() As String
Caption = m_Caption
End Property
Public Property Set Font(ByVal NewFont As StdFont)
Set UserControl.Font = NewFont
PropertyChanged "Font"
DrawButton (eNormal)
End Property
Public Property Get Font() As StdFont
Set Font = UserControl.Font
End Property
Private Sub UserControl_Initialize()
m_Style = Style
End Sub
Private Sub UserControl_InitProperties()
If Not Ambient.UserMode Then
m_bEnabled = True
m_ColorButtonHover = &HFFC090
m_ColorButtonUp = &HE99950
m_ColorBright = &HFFEDB0
m_ColorButtonDown = &HE99950
m_Caption = UserControl.Name
UserControl.Picture = LoadPicture("")
End If
m_Caption = Extender.Name
m_InitCompleted = True
End Sub
Private Sub UserControl_KeyDown(KeyCode As Integer, Shift As Integer)
If Not m_bEnabled Then Exit Sub
If KeyCode = vbKeyReturn Then UserControl_MouseDown 1, 0, 0, 0
End Sub
Private Sub UserControl_KeyUp(KeyCode As Integer, Shift As Integer)
If Not m_bEnabled Then Exit Sub
If KeyCode = vbKeyReturn Then
UserControl_MouseUp 1, 0, 0, 0
RaiseEvent Click
End If
End Sub
Private Sub UserControl_Click()
If Not m_bEnabled Then Exit Sub
RaiseEvent Click
End Sub
Private Sub UserControl_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Not m_bEnabled Then Exit Sub
m_hasFocus = True
DrawButton (ePressed)
RaiseEvent MouseDown(Button, Shift, X, Y)
End Sub
Private Sub UserControl_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Not m_bEnabled Then Exit Sub
RaiseEvent MouseMove(Button, Shift, X, Y)
If Button = 1 And (X < 0 Or X > ScaleWidth Or _
Y < 0 Or Y > ScaleHeight) Then
IsHover = False
DrawButton (eNormal)
End If
End Sub
Private Sub UserControl_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Not m_bEnabled Then Exit Sub
If Not m_Checked Then
If IsHover Then
DrawButton (eHover)
Else
If m_hasFocus Then DrawButton (eFocus)
End If
End If
RaiseEvent MouseUp(Button, Shift, X, Y)
End Sub
Private Sub UserControl_DblClick()
If Not m_bEnabled Then Exit Sub
DrawButton (ePressed)
RaiseEvent DblClick
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -