怎么做浮动的工具条
怎么做浮动的工具条
楼主getgoodgift(一心一意)2003-06-30 16:50:55 在 VB / 基础类 提问RT 问题点数:10、回复次数:3Top
1 楼lihonggen0(李洪根,MS MVP,标准答案来了)回复于 2003-06-30 17:04:23 得分 5
1
Coolbar + Toolbar
2、ActiveBarTop
2 楼getgoodgift(一心一意)回复于 2003-06-30 17:12:57 得分 0
ActiveBar在哪一组上啊Top
3 楼nosuchman(吴慈仁)回复于 2003-07-04 13:27:18 得分 5
试试这个,只需用到MouseDown/up/move事件,就可实现工具条的自由拖动,若要拖动到窗体外则会自动Align 到窗体上,将ToolBar改为CoolBar则效果可能会更好
Dim MousePress As Integer
Dim MouseLocationX As Integer
Dim MouseLocationY As Integer
Dim ToolBarWidth As Long "工具条的初始宽度,可在Form_load事件中赋值
Private Sub toolbar1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
MousePress = 1
MouseLocationX = x
MouseLocationY = y
"Toolbar1.MousePointer = ccSizeAll
End Sub
Private Sub toolbar1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim Top As Long
Dim Left As Long
If MousePress = 1 Then
Toolbar1.MousePointer = ccSizeAll
Top = Toolbar1.Top + y - MouseLocationY
Left = Toolbar1.Left + x - MouseLocationX
If Top + Toolbar1.Height < 0 Then
Toolbar1.Align = vbAlignTop
ElseIf Left + Toolbar1.Width < 0 Then
Toolbar1.Align = vbAlignLeft
ElseIf Top > Me.ScaleHeight Then
Toolbar1.Align = vbAlignBottom
ElseIf Left > Me.ScaleWidth Then
Toolbar1.Align = vbAlignRight
Else
Toolbar1.Align = vbAlignNone
Toolbar1.Width = ToolBarWidth
Toolbar1.Top = Toolbar1.Top + y - MouseLocationY
Toolbar1.Left = Toolbar1.Left + x - MouseLocationX
End If
End If
End Sub
Private Sub toolbar1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
MousePress = 0
Toolbar1.MousePointer = ccDefault
End Sub
Top
-
相关文章
2秒记住本站域名
玩过泡泡龙吗?Readygo?Go! 再加上.Com.Cn的后缀,那就是大名小顶的readygo.com.cn
