在VB中我在窗体中放了一个media player 控件,想拖动该控件窗体也跟着移动到相应的位置
在VB中我在窗体中放了一个mediaplayer控件,想拖动该控件窗体也跟着移动到相应的位置,是拖动播放器控件,不能拖动窗体,我的窗体已经设置为不显示标题栏...
在VB中我在窗体中放了一个media player 控件,想拖动该控件窗体也跟着移动到相应的位置,是拖动播放器控件,不能拖动窗体,我的窗体已经设置为不显示标题栏
展开
1个回答
展开全部
该播放控件拖动效果不好,改成窗体拖动好,(即使窗体已经设置为不显示标题栏)也可以拖
Private downx As Long
Private downy As Long
Private xx As Long
Private yy As Long
Private MouseDown As Boolean
Private Sub form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
downx = X
downy = Y
MouseDown = True
End Sub
Private Sub form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
xx = X
yy = Y
If MouseDown = True Then Me.Move Me.Left + (xx - downx), Me.Top + (yy - downy)
End Sub
Private Sub form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
MouseDown = False
End Sub
Private downx As Long
Private downy As Long
Private xx As Long
Private yy As Long
Private MouseDown As Boolean
Private Sub form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
downx = X
downy = Y
MouseDown = True
End Sub
Private Sub form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
xx = X
yy = Y
If MouseDown = True Then Me.Move Me.Left + (xx - downx), Me.Top + (yy - downy)
End Sub
Private Sub form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
MouseDown = False
End Sub
更多追问追答
追问
但是现在我的窗体都已经被media player控件覆盖了
追答
Private downx As Long
Private downy As Long
Private xx As Long
Private yy As Long
Private MouseDown As Boolean
Private Sub WindowsMediaPlayer1_MouseDown(ByVal nButton As Integer, ByVal nShiftState As Integer, ByVal fX As Long, ByVal fY As Long)
downx = fX
downy = fY
MouseDown = True
End Sub
Private Sub WindowsMediaPlayer1_MouseMove(ByVal nButton As Integer, ByVal nShiftState As Integer, ByVal fX As Long, ByVal fY As Long)
xx = fX
yy = fY
If MouseDown = True Then Me.Move Me.Left + (xx - downx), Me.Top + (yy - downy)
End Sub
Private Sub WindowsMediaPlayer1_MouseUp(ByVal nButton As Integer, ByVal nShiftState As Integer, ByVal fX As Long, ByVal fY As Long)
MouseDown = False
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询