首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > VB Dotnet >

为何父窗体鼠标按下事件无效

2013-12-02 
为什么父窗体鼠标按下事件无效Private Sub Form2_MouseMove(ByVal Button As Integer, ByVal Shift As Int

为什么父窗体鼠标按下事件无效
   
 Private Sub Form2_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
        If Button = 3 Then
            MsgBox("Error encountered while trying to open file," & vbCrLf & "please retry.", vbExclamation, "Text Editor")
        End If
End Sub

只有父窗体时无效,创建子窗体也无效。

请老师指点。
[解决办法]
在form1里调用form2后:

   Dim ff As New Form2()
        ff.Show()
在form2里
 Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        tools()
    End Sub

    Private Sub Form2_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
        If e.Clicks Then
            MsgBox("Error encountered while trying to open file," & vbCrLf & "please retry.", vbExclamation, "Text Editor")
        End If
    End Sub
    Private Sub tools()

    End Sub

热点排行