📄 yfoptionbutton.ctl
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.UserControl YFOptionButton
BackColor = &H00FCBD6C&
ClientHeight = 1110
ClientLeft = 0
ClientTop = 0
ClientWidth = 4770
ScaleHeight = 1110
ScaleWidth = 4770
ToolboxBitmap = "YFOptionButton.ctx":0000
Begin MSComctlLib.ImageList ImageList2
Left = 4020
Top = 330
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 10
ImageHeight = 10
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 2
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "YFOptionButton.ctx":0312
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "YFOptionButton.ctx":0388
Key = ""
EndProperty
EndProperty
End
Begin VB.Image imgDX
Height = 150
Left = 0
Picture = "YFOptionButton.ctx":0401
Top = 0
Width = 150
End
Begin VB.Image imgFX
Height = 150
Index = 0
Left = 0
Picture = "YFOptionButton.ctx":0467
Top = 0
Width = 150
End
Begin VB.Label labFX
BackStyle = 0 'Transparent
Caption = " 关键字查询"
ForeColor = &H00404040&
Height = 225
Left = 150
TabIndex = 0
Top = 0
Width = 1485
End
End
Attribute VB_Name = "YFOptionButton"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
'*************************************************************************
'**模 块 名:YFOptionButton
'**说 明:YFsoft 叶帆Blog:http://blog.csdn.net/yefanqiu/
'**创 建 人:叶帆
'**日 期:2004-12-14 09:45:30
'**修 改 人:
'**日 期:
'**描 述:Option 控件
'**版 本:V1.0.0
'*************************************************************************
Option Explicit
Dim m_Value As Boolean
Dim m_Text As String
Dim m_color As String
Event Click()
Private Sub UserControl_Initialize()
m_Text = "Option"
labFX.Caption = m_Text
m_color = "000000"
End Sub
Private Sub UserControl_Resize()
UserControl.Height = 180
imgDX.Left = 0
labFX.Left = imgDX.Left + imgDX.Width + 10
labFX.Width = UserControl.Width - imgDX.Width + 10
End Sub
Private Sub labFX_Click()
imgDX_Click
End Sub
Private Sub imgDX_Click()
m_Value = True
imgDX.Picture = ImageList2.ListImages(2).Picture
RaiseEvent Click
End Sub
'从PropertyBag中读属性值
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
'--------------------------------------------------------------
'取数据
m_Text = PropBag.ReadProperty("Text", "Option")
m_Value = PropBag.ReadProperty("Value", False)
m_color = PropBag.ReadProperty("Color", "000000")
If Len(m_color) < 6 Then
m_color = Left("000000", 6 - Len(m_color)) + m_color
Else
m_color = Left(m_color, 6)
End If
labFX.ForeColor = RGB(Val("&h" + Mid(m_color, 1, 2)), Val("&h" + Mid(m_color, 3, 2)), Val("&h" + Mid(m_color, 5, 2)))
labFX.Caption = m_Text
If m_Value = True Then
imgDX.Picture = ImageList2.ListImages(2).Picture
Else
imgDX.Picture = ImageList2.ListImages(1).Picture
End If
End Sub
'把属性值保存在PropertyBag中
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
'----------------------------------------------------------------
'存属性值
PropBag.WriteProperty "Text", m_Text, "Option"
PropBag.WriteProperty "Value", m_Value, False
PropBag.WriteProperty "Color", m_color, "000000"
End Sub
Public Property Get Color() As String
Color = m_color
End Property
Public Property Let Color(ByVal vNewValue As String)
m_color = vNewValue
If Len(m_color) < 6 Then
m_color = Left("000000", 6 - Len(m_color)) + m_color
Else
m_color = Left(m_color, 6)
End If
labFX.ForeColor = RGB(Val("&h" + Mid(m_color, 1, 2)), Val("&h" + Mid(m_color, 3, 2)), Val("&h" + Mid(m_color, 5, 2)))
PropertyChanged "Color"
End Property
Public Property Get Text() As String
Text = m_Text
End Property
Public Property Let Text(ByVal vNewValue As String)
m_Text = vNewValue
labFX.Caption = m_Text
PropertyChanged "Text"
End Property
Public Property Get Value() As Boolean
Value = m_Value
End Property
Public Property Let Value(ByVal vNewValue As Boolean)
m_Value = vNewValue
If m_Value = True Then
imgDX.Picture = ImageList2.ListImages(2).Picture
Else
imgDX.Picture = ImageList2.ListImages(1).Picture
End If
PropertyChanged "Value"
End Property
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -