在VB中我在窗体中放了一个media player 控件,想拖动该控件窗体也跟着移动到相应的位置

在VB中我在窗体中放了一个mediaplayer控件,想拖动该控件窗体也跟着移动到相应的位置,是拖动播放器控件,不能拖动窗体,我的窗体已经设置为不显示标题栏... 在VB中我在窗体中放了一个media player 控件,想拖动该控件窗体也跟着移动到相应的位置,是拖动播放器控件,不能拖动窗体,我的窗体已经设置为不显示标题栏 展开
 我来答
沙慧月03
2011-03-09 · TA获得超过2157个赞
知道大有可为答主
回答量:2717
采纳率:100%
帮助的人:3625万
展开全部
该播放控件拖动效果不好,改成窗体拖动好,(即使窗体已经设置为不显示标题栏)也可以拖

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
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式