我是一个初学者!请问如何用api实现ie4/office97的浮动按钮!

kmj 2000-07-13 08:53:00
我是一个初学者!请问如何用api实现ie4/office97的浮动按钮!
...全文
128 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
Nicrosoft 2000-08-10
  • 打赏
  • 举报
回复
用VB5谁说不可以了?

在VB5下安装VB6的ocx就可以了,或者拷贝一份ocx,然后注册一下。
prefix 2000-08-09
  • 打赏
  • 举报
回复
bluewater说得对。如果用vb5就要这样。
你怎么不给分? 人家可帮了你呀。
Un1 2000-07-17
  • 打赏
  • 举报
回复
http://expert.csdn.net/Topic/15391.shtm
jienao 2000-07-13
  • 打赏
  • 举报
回复
如果你用的是VB6那就如liyang所说的那样就行了,但如果是VB5那么就得用API了。
liyang 2000-07-13
  • 打赏
  • 举报
回复
你只要使用microsoft windows common control中的toolbar,然后把toolbar的style改为tbrFlat即可。
bluewater 2000-07-13
  • 打赏
  • 举报
回复
Office或IE4风格的ToolBar
用API可以轻松改变 ToolBar 的风格。需要 4.70 或其以上版本的 comctl32.dll 支持。
声明:
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"
函数:
' tlbToolbarStyle :
'1 为 Office97 风格
'2 为 IE4 风格
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_FLATEnd Select
' Use the API call to change the toolbar

lngResult=SendMessage(lngHWND, _
TB_SETSTYLE, 0, lngStyle) ' Show the effects
tlb.Refresh

End Sub

在 Form 装入时调用:
Private Sub Form_Load()
Call ToolbarStyle(Me.Toolbar1, 2) ' …
End Sub
-----------------------------------------------------------------------------
关于ToolBar 风格的说明:
Office 风格的 Toolbar 是指在鼠标移动到 ICON 后, 会出现边框。如我们在 VB5 中
用的一样。 而comctl的ToolBar是没有该效果的。 IE4 风格的 Toolbar 可以在ICON下
面出现文字, 如同 IE4 中的Toolbar 一样。(可能是反一下。。。。)

1,486

社区成员

发帖
与我相关
我的任务
社区描述
VB API
社区管理员
  • API
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧