以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]ListView选中行问题  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=93995)

--  作者:pcxjxjhkw
--  发布时间:2016/12/12 22:54:00
--  [求助]ListView选中行问题

ListView为大图标模式,如何实现:

 

鼠标移动到某图标位置,就选中该图标。

 

 


--  作者:有点蓝
--  发布时间:2016/12/12 23:12:00
--  
全局代码
Public Sub ListView1_ItemMouseHover(sender As Object, e As system.windows.forms.ListViewItemMouseHoverEventArgs)
        e.Item.Selected = True
    End Sub

窗口afterload事件

Dim lsv As system.windows.Forms.ListView = e.Form.Controls("ListView1").basecontrol
AddHandler lsv.ItemMouseHover, AddressOf ListView1_ItemMouseHover

--  作者:pcxjxjhkw
--  发布时间:2016/12/12 23:21:00
--  
以下是引用有点蓝在2016/12/12 23:12:00的发言:
全局代码
Public Sub ListView1_ItemMouseHover(sender As Object, e As system.windows.forms.ListViewItemMouseHoverEventArgs)
        e.Item.Selected = True
    End Sub

窗口afterload事件

Dim lsv As system.windows.Forms.ListView = e.Form.Controls("ListView1").basecontrol
AddHandler lsv.ItemMouseHover, AddressOf ListView1_ItemMouseHover


--  作者:pcxjxjhkw
--  发布时间:2016/12/12 23:34:00
--  
以下是引用有点蓝在2016/12/12 23:12:00的发言:
全局代码
Public Sub ListView1_ItemMouseHover(sender As Object, e As system.windows.forms.ListViewItemMouseHoverEventArgs)
        e.Item.Selected = True
    End Sub

窗口afterload事件

Dim lsv As system.windows.Forms.ListView = e.Form.Controls("ListView1").basecontrol
AddHandler lsv.ItemMouseHover, AddressOf ListView1_ItemMouseHover

老师,所有图标都被选中了!未取消其它图标选中状态。


--  作者:有点蓝
--  发布时间:2016/12/13 8:40:00
--  
不用上面那种方式了,窗口afterload事件改成下面的,去掉全局代码

Dim lsv As system.windows.forms.ListView = e.Form.Controls("ListView1").basecontrol
lsv.HoverSelection = True
[此贴子已经被作者于2016/12/13 8:40:40编辑过]