以前做过类似的偶是用个PICTUREBOX。把控件放在PICTUREBOX里面。设置为最顶层需要的时候就显示出来不需要就隐藏。然后在PICTUREBOX上加上鼠标拖动效果个人感觉还是可以的 鼠标拖动PICTURE的代码 dim moving as boolean dim MouseX as Single dim MouseY as SinglePrivate Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 1 Then moving = True MouseX = X MouseY = Y End If End SubPrivate Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If moving = False Or Not (Button = 1) Then Exit Sub With Picture1 .Left = Picture1.Left - MouseX + X .Top = Picture1.Top - MouseY + Y End WithEnd SubPrivate Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) moving = False End Sub
楼上的正好反了 b.show 0 b窗口置顶!Const HWND_TOPMOST = -1 Const HWND_NOTOPMOST = -2 Const SWP_NOSIZE = &H1 Const SWP_NOMOVE = &H2 Const SWP_NOACTIVATE = &H10 Const SWP_SHOWWINDOW = &H40 Private Declare Sub SetWindowPos Lib "User32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long)Private Sub Form_Activate() SetWindowPos Me.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE End Sub
这样就有你要的效果了。
鼠标拖动PICTURE的代码
dim moving as boolean
dim MouseX as Single
dim MouseY as SinglePrivate Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
moving = True
MouseX = X
MouseY = Y
End If
End SubPrivate Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If moving = False Or Not (Button = 1) Then Exit Sub
With Picture1
.Left = Picture1.Left - MouseX + X
.Top = Picture1.Top - MouseY + Y
End WithEnd SubPrivate Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
moving = False
End Sub
b.show 0
b窗口置顶!Const HWND_TOPMOST = -1
Const HWND_NOTOPMOST = -2
Const SWP_NOSIZE = &H1
Const SWP_NOMOVE = &H2
Const SWP_NOACTIVATE = &H10
Const SWP_SHOWWINDOW = &H40
Private Declare Sub SetWindowPos Lib "User32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long)Private Sub Form_Activate()
SetWindowPos Me.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE
End Sub