.net让listview聚焦或滚动位置 [英] .net let listview focus or scroll position

查看:84
本文介绍了.net让listview聚焦或滚动位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

伙计,谢谢你

我很难理解这一点,我刷新了listView项,每次刷新时,它都会重置焦点/滚动位置.您能告诉我如何以编程方式设置焦点/滚动位置吗?

以下是我的代码

Hi guy, thank you in advance

im having a great dificulty figuting this out, im refreshing my listView items and everytime it refreshes, it resets the focus/scroll position. would you please tell me how i can set the focus/scroll position programatically?

below is my code

Public Sub refreshListView()
      lvSrc.BeginUpdate()
      'lvSrc.SuspendLayout()
      lvSrc.Items.Clear()
      For index As Integer = 0 To xRSignal.Count - 1

          If Not (IsNumeric(xRSignal(index))) Then
              Dim item3 As New ListViewItem
              item3.Text = xRSignal(index)
              item3.SubItems.Add(xRValue(index))
              'item3.SubItems.Add()
              lvSrc.Items.Add(item3)
              'Else
              '    Dim item2 As New ListViewItem
              '    lvSrc.Items.Add(item2)
              '    Dim item3 As New ListViewItem
              '    item3.Text = xRMsgName(index)
              '    item3.SubItems.Add(xRSignal(index))
              '    'item3.SubItems.Add()
              '    lvSrc.Items.Add(item3)
          End If
      Next
      'lvSrc.ResumeLayout()
      lvSrc.EndUpdate()
  End Sub

推荐答案

在开始刷新Listview之前,请记住所选项目的文本,而不要使用 ^ ].
Before you start refreshing Listview, remember text for selected item, than use FindItemWithText() method[^].


这篇关于.net让listview聚焦或滚动位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆