Private Sub UserControl_Resize ()
UserControl.Width = 540
UserControl.Height = 540
Image1.Move 0, 0, ScaleWidth, ScaleHeight
End Sub
'Wrote to attribute value memory
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
'Button access to text
Public Property Get ButtonText () As String
ButtonText = m_ButtonText
End Property
'Settings button text
Public Property Let ButtonText (ByVal New_ButtonText As String)
M_ButtonText = New_ButtonText
PropertyChanged "ButtonText"
End Property
'Button access to the current implementation of goals
Public Property Get Exec () As String
Exec = m_Exec
End Property
'Button implementation of the goals set
Public Property Let Exec (ByVal New_Exec As String)
M_Exec = New_Exec
PropertyChanged "Exec"
End Property
'Get Mouse button on the icon that appears when
Public Property Get HotIcon () As String
HotIcon = m_HotIcon
End Property
'Mouse settings displayed on the button icon
Public Property Let HotIcon (ByVal New_HotIcon As String)
M_HotIcon = New_HotIcon
PropertyChanged "HotIcon"
End Property
'Access to the normal display button icons
Public Property Get Icon () As String
Icon = m_Icon
End Property
'Settings button icons shown in normal
Public Property Let Icon (ByVal New_Icon As String)
M_Icon = New_Icon
PropertyChanged "Icon"
End Property
'Access to the text menu item
Public Property Get MenuText () As String
MenuText = m_MenuText
End Property
'Settings menu item text display
Public Property Let MenuText (ByVal New_MenuText As String)
M_MenuText = New_MenuText
PropertyChanged "MenuText"
End Property
'Access to a menu item text Notes
Public Property Get MenuStatusBar () As String
MenuStatusBar = m_MenuStatusBar
End Property
'Settings menu item text Notes
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
'Show "About" dialog box
Public Sub ShowAboutBox ()
FrmAbout.Show vbModal
Unload frmAbout
Set frmAbout = Nothing
End Sub
The controls provide the seven attributes and two methods.
Control attributes:
● GUID: a logo in the registry only the number of application software sequence, a total of 36;
● ButtonText: button displayed on the text;
● Exec: button implementation of the objectives for the executable file or hyperlinks;
● HotIcon: Mouse button on the display icon from the EXE or DLL file documents;
● Icon: normal display button icons, documents from the EXE or DLL file;
● MenuText: IE "tools" menu to display the menu items;
● MenuStatusBar: IE "tools" menu item explained that in the bottom of the state.
Control methods:
● AddBtn2IEtoolbar: Add Custom button;
● DelBtnFromIEtoolbar: Delete Custom button.
Use (VB example)
In VB, first of all, the user controls by adding "components" list, then the controls from the "toolbox" drag-and-drop to the EXE project on the form, then put in the form of two command buttons named cmdADD and cmdDel, type the following code:
Option Explicit
'The GUID numbers with a special tool
Const theGUID = "(3FA4FB86-E43A-11D4-B3DD-00E006E25C0B)"
Private Sub cmdAdd_Click () 'Add button
AddButton1.Guid = theGUID
AddButton1.ButtonText = "control"
AddButton1.Exec = "http://why100000.at.
China.com "
AddButton1.HotIcon = "C: \ Add2IE Toolbar \ Add2IEToolbar.exe, 101"
AddButton1.Icon = "C: \ Add2IE Toolbar \ Add2IEToolbar.exe, 102"
AddButton1.MenuText = "control test"
AddButton1.MenuStatusBar = "test, I made ActiveX controls"
AddButton1.AddBtn2IEtoolbar 'implementation
End Sub
Private Sub cmdDel_Click () 'Delete button
AddButton1.Guid = theGUID
AddButton1.DelBtnFromIEtoolbar
End Sub
Above code, GUID, can be used in VC + + 6.0 provided a GUID generator tools. Method: running VC + + 6.0, open a project, "Project \ Add to Project \ Components and Controls \ Visual C + + Components \ GUID Generator", click "Insert" button, and determined, to select four "Registry Format" , and click the "Copy" button, GUID will be a new generation of the GUID, copied to the clipboard on.
Button icons included in the C: \ Add2IE Toolbar \ Add2IEToolbar.exe paper, 101 and 102 are in the order of their. By cmdAdd button, and then open IE browser, you will see that IE toolbar add custom buttons. |