以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  求助 鼠标中键  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=133133)

--  作者:jackyfashion
--  发布时间:2019/4/7 23:00:00
--  求助 鼠标中键
老师:
您好!
请问判断鼠标中键上下滚动的代码怎样写?
请老师指教!!!
谢谢!!!

--  作者:有点甜
--  发布时间:2019/4/7 23:08:00
--  

在什么时候需要用到?请具体说明一下场景。

 

要去绑定 mousewheel 事件?

 

http://foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=55394&replyID=368746&skin=1

 

http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=41235&skin=0


--  作者:客人
--  发布时间:2019/4/8 23:37:00
--  
老师:
您好!
TextBox控件,输入是年度,用滚轮上下度调上下年度
ComboBox,控件,上下滚动选取列表项目.
谢老师指教!!!
刚下载的两个文件非开发版,所以打不开.
谢谢老师!!!

--  作者:有点甜
--  发布时间:2019/4/9 10:01:00
--  

用2楼的例子,即可。

 

你在下载开发版的那个网页,下载一个【商业版】的,安装,即可打开使用。


--  作者:jackyfashion
--  发布时间:2019/4/9 20:59:00
--  
谢谢老师!!!
谢谢!!!

--  作者:jackyfashion
--  发布时间:2019/4/9 23:01:00
--  
老师:
您好!
我窗口Afterload的代码是For i As Integer = 1 To 2
    Dim a As System.Windows.Forms.Control = e.Form.Controls("comboBox" & i).BaseControl
    AddHandler a.MouseWheel, AddressOf  MyMouseWheel
Next
内部函数
Dim sender As system.object = Args(0)
Dim e As System.Windows.Forms.MouseEventArgs = Args(1)
Dim s As object
    For i As Integer = 1 To 2
        s = Forms("窗口1").Controls("comboBox" & i)  
Dim idx As Integer = s.items.IndexOf(sender.Text)
If e.Delta < 0 Then
    If idx > -1 Then
        If idx < s.items.count - 1 Then
            sender.Text = s.items(idx+1)
        End If
    Else
        sender.Text = s.items(0)
    End If
Else
    If idx > -1 Then
        If idx > 0 Then
            sender.Text = s.items(idx-1)
        End If
    Else
        sender.Text = s.items(s.items.count-1)
    End If
End If

提示:
.NET Framework 版本:2.0.50727.8789
Foxtable 版本:2018.10.9.1
错误所在事件:自定义函数ImyMouseWheel
详细错误信息:
调用的目标发生了异常。
InvalidArgument=“-1”的值对于“index”无效。
参数名: index
请老师指教!!!
谢谢!!!


--  作者:有点蓝
--  发布时间:2019/4/9 23:06:00
--  
Else
    If idx > -1 Then
        If idx > 0 andalso  idx < s.items.count Then
            sender.Text = s.items(idx-1)
        End If
    Else
        sender.Text = s.items(s.items.count-1)
    End If
End If

--  作者:jackyfashion
--  发布时间:2019/4/9 23:07:00
--  
谢谢老师!!!
谢谢!!!

--  作者:jackyfashion
--  发布时间:2019/4/10 20:39:00
--  
老师:
您好!
加入

Else

    If idx > -1 Then

        If idx > 0 andalso  idx < s.items.count Then

            sender.Text = s.items(idx-1)

        End If

    Else

        sender.Text = s.items(s.items.count-1)

    End If

End If

还是提示:

.NET Framework 版本:2.0.50727.8789

Foxtable 版本:2018.10.9.1

错误所在事件:自定义函数ImyMouseWheel

详细错误信息:

调用的目标发生了异常。

InvalidArgument=“-1”的值对于“index”无效。

参数名: index

我的数据是文本

请老师指教!!!

谢谢!!!

[此贴子已经被作者于2019/4/10 20:42:53编辑过]

--  作者:有点甜
--  发布时间:2019/4/10 21:54:00
--  

 

出错的实例发上来测试。