西安市含光门外中原小区1号楼3单元702(710068) 张庆
Private Sub UserControl_Resize()
UserControl.Width = 540
UserControl.Height = 540
Image1.Move 0, 0, ScaleWidth, ScaleHeight
End Sub
''将属性值写到存储器
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
Call PropBag.WriteProperty(“ButtonText",
m_ButtonText, m_def_ButtonText)
Call PropBag.WriteProperty(“Exec", m_Exec,
m_def_Exec)
Call PropBag.WriteProperty(“HotIcon",
m_HotIcon, m_def_HotIcon)
Call PropBag.WriteProperty(“Icon",
m_Icon, m_def_Icon)
Call PropBag.WriteProperty(“MenuText",
m_MenuText, m_def_MenuText)
Call PropBag.WriteProperty(“MenuStatusBar",
m_MenuStatusBar, m_def_MenuStatusBar)
Call PropBag.WriteProperty(“GUID",m_GUID,
m_def_GUID)
End Sub
’获取按钮文本
Public Property Get ButtonText() As String
ButtonText = m_ButtonText
End Property
’设置按钮文本
Public Property Let ButtonText(ByVal New_ButtonText As String)
m_ButtonText = New_ButtonText
PropertyChanged “ButtonText"
End Property
’获取当前按钮执行目标
Public Property Get Exec() As String
Exec = m_Exec
End Property
’设置当前按钮执行目标
Public Property Let Exec(ByVal New_Exec As String)
m_Exec = New_Exec
PropertyChanged “Exec"
End Property
’获取鼠标移上按钮时显示的图标
Public Property Get HotIcon() As String
HotIcon = m_HotIcon
End Property
’设置鼠标移上按钮时显示的图标
Public Property Let HotIcon(ByVal New_HotIcon As String)
m_HotIcon = New_HotIcon
PropertyChanged “HotIcon"
End Property
’获取按钮正常显示的图标
Public Property Get Icon() As String
Icon = m_Icon
End Property
’设置按钮正常显示的图标
Public Property Let Icon(ByVal New_Icon As String)
m_Icon = New_Icon
PropertyChanged “Icon"
End Property
’获取菜单项显示文本
Public Property Get MenuText() As String
MenuText = m_MenuText
End Property
’设置菜单项显示文本
Public Property Let MenuText(ByVal New_MenuText As String)
m_MenuText = New_MenuText
PropertyChanged “MenuText"
End Property
’获取菜单项注释文本
Public Property Get MenuStatusBar() As String
MenuStatusBar = m_MenuStatusBar
End Property
’设置菜单项注释文本
Public Property Let MenuStatusBar(ByValNew_Menu
StatusBar As String)
m_MenuStatusBar = New_MenuStatusBar
PropertyChanged “MenuStatusBar"
End Property
Public Property Get GUID() As String
GUID = m_GUID
End Property
Public Property Let GUID(ByVal New_GUID As String)
m_GUID = New_GUID
PropertyChanged “GUID"
End Property
’显示“关于”对话框
Public Sub ShowAboutBox()
frmAbout.Show
vbModal
Unload frmAbout
Set frmAbout = Nothing
End Sub
该控件提供了 7 个属性和2 个方法。
控件的属性:
●GUID:一个在
注册表唯一标识应用软件的数字序列,共36位;
●ButtonText:按钮上显示的文本;
●Exec:按钮执行的目标,为可执行文件或超文本
链接等;
●HotIcon:鼠标移上按钮时显示的图标,取自 EXE 文件或 DLL 文件;
●Icon:按钮正常显示的图标,取自 EXE 文件或 DLL 文件;
●MenuText:在 IE “工具”菜单中显示的菜单项;
●MenuStatusBar:IE“工具”菜单项的解释,显示在底部的状态条上。
控件的方法:
●AddBtn2IEtoolbar:添加自定义按钮;
●DelBtnFromIEtoolbar:删除自定义按钮。
使用方法(以VB为例)