IE式浮动工具栏VB源码程序,程序员在编程的过程中可以参考学习使用,希望对IT程序员有用,此源码程序简单易懂、方便阅读,有很好的学习价值!
VERSION 5.00
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 4260
ClientLeft = 60
ClientTop = 345
ClientWidth = 6390
LinkTopic = "Form1"
ScaleHeight = 4260
ScaleWidth = 6390
StartUpPosition = 3 '窗口缺省
Begin ComctlLib.Toolbar Toolbar1
Align = 1 'Align Top
Height = 615
Left = 0
TabIndex = 0
Top = 0
Width = 6390
_ExtentX = 11271
_ExtentY = 1085
ButtonWidth = 979
ButtonHeight = 926
Appearance = 1
ImageList = "ImageList1"
_Version = 327682
BeginProperty Buttons {0713E452-850A-101B-AFC0-4210102A8DA7}
NumButtons = 7
BeginProperty Button1 {0713F354-850A-101B-AFC0-4210102A8DA7}
Caption = "New"
Key = "New"
Object.Tag = ""
ImageIndex = 1
EndProperty
BeginProperty Button2 {0713F354-850A-101B-AFC0-4210102A8DA7}
Caption = "Open"
Key = "Open"
Object.Tag = ""
ImageIndex = 2
EndProperty
BeginProperty Button3 {0713F354-850A-101B-AFC0-4210102A8DA7}
Caption = "Save"
Key = "Save"
Object.Tag = ""
ImageIndex = 3
EndProperty
BeginProperty Button4 {0713F354-850A-101B-AFC0-4210102A8DA7}
Caption = "Close"
Key = "Close"
Object.Tag = ""
ImageIndex = 4
EndProperty
BeginProperty Button5 {0713F354-850A-101B-AFC0-4210102A8DA7}
Key = ""
Object.Tag = ""
Style = 3
MixedState = -1 'True
EndProperty
BeginProperty Button6 {0713F354-850A-101B-AFC0-4210102A8DA7}
Caption = "Copy"
Key = "Copy"
Object.Tag = ""
ImageIndex = 5
EndProperty
BeginProperty Button7 {0713F354-850A-101B-AFC0-4210102A8DA7}
Caption = "Cut"
Key = "Cut"
Object.Tag = ""
ImageIndex = 6
EndProperty
EndProperty
BorderStyle = 1
End
Begin VB.CommandButton Command1
Caption = "IE式"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 1680
TabIndex = 1
Top = 2520
Width = 2175
End
Begin ComctlLib.ImageList ImageList1
Left = 120
Top = 1080
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 16
MaskColor = 12632256
_Version = 327682
BeginProperty Images {0713E8C2-850A-101B-AFC0-4210102A8DA7}
NumListImages = 6
BeginProperty ListImage1 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = "FloatBar.frx":0000
Key = ""
EndProperty
BeginProperty ListImage2 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = "FloatBar.frx":0112
Key = ""
EndProperty
BeginProperty ListImage3 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = "FloatBar.frx":0224
Key = ""
EndProperty
BeginProperty ListImage4 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = "FloatBar.frx":0336
Key = ""
EndProperty
BeginProperty ListImage5 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = "FloatBar.frx":0448
Key = ""
EndProperty
BeginProperty ListImage6 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = "FloatBar.frx":055A
Key = ""
EndProperty
EndProperty
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Integer, _
ByVal lParam As Any _
) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
(ByVal hWnd1 As Long, _
ByVal hWnd2 As Long, _
ByVal lpsz1 As String, _
ByVal lpsz2 As String _
) As Long
Private Const WM_USER = &H400
Private Const TB_SETSTYLE = WM_USER + 56
Private Const TB_GETSTYLE = WM_USER + 57
Private Const TBSTYLE_FLAT = &H800
Private Const TBSTYLE_LIST = &H1000
Public Sub ToolbarStyle(tlb As Toolbar, _
tlbToolbarStyle As Long)
Dim lngStyle As Long
Dim lngResult As Long
Dim lngHWND As Long
' Find child window and get style bits
lngHWND = FindWindowEx(tlb.hwnd, 0&, "ToolbarWindow32", vbNullString)
lngStyle = SendMessage(lngHWND, TB_GETSTYLE, 0&, 0&)
' Use a case statement to get the effect
Select Case tlbToolbarStyle
Case 1:
' Creates an Office 97 like toolbar
lngStyle = lngStyle Or TBSTYLE_FLAT
Case 2:
' Creates an Explorer 4.0 like toolbar,
' with text to the right
' of the picture. You must provide text
' in order to get the effect.
lngStyle = lngStyle Or TBSTYLE_FLAT Or TBSTYLE_LIST
Case Else
lngStyle = lngStyle Or TBSTYLE_FLAT
End Select
' Use the API call to change the toolbar
lngResult = SendMessage(lngHWND, TB_SETSTYLE, 0, lngStyle)
' Show the effects
tlb.Refresh
End Sub
Private Sub Command1_Click()
Me.Toolbar1.ButtonWidth = 1000
Call ToolbarStyle(Me.Toolbar1, 2)
End Sub