同步ListView滚动条 [英] Synchronize ListView Scrollbars

查看:107
本文介绍了同步ListView滚动条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好!我正在尝试在这里建立一个应用程序,我必须在几天内为我的检查生成。项目外观的一部分要求我使用两个列表视图。项目的工作是使列表视图的内容相互比较,并从em中选择差异。那部分是处理的。现在的问题是我需要同步listview控件的滚动条,以便当listview1向下滚动时,即使listview2也向下滚动到与listview1相同的级别,反之亦然。两者,水平和垂直滚动条都要同步。

有人可以帮我解决这个问题吗?我已经尝试了一个多月,但没有运气。我很感激能把我救出来的人!!
拜托!救命! 搜索结果 - 结果,罗格结果
解决方案


嗨罗杰,


您可以创建自定义ListView并覆盖WinProc为ListView提供Scroll事件。您可以查看以下文章,了解如何为ListView提供滚动事件:


· http://www.devnewsgroups.net/group/microsoft.public .dotnet.framework.windowsforms / topic34807.aspx


完成为ListView提供Scroll事件后,您可以处理Scroll事件并将相同的消息发送到第二个ListView,或使用TopItem同步两个ListView。以下是供参考的示例:


· http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3089588&SiteID=1


希望这会有所帮助。
最好的问候。
张荣春


Hello there!
I am trying to build an application here which I have to produce for my examination in a few days. A part of the appearance of the project requires me to use two listviews. The working of the project is such that the contents of the listview are compared against each other and the difference is picked from em. That part is handled. Now the issue is that I need to synchronize the listview control's scroll bars so that when listview1 is scrolled down even the listview2 is also scrolled down to the same level as listview1, and the same vice versa. Both, the horizontal and vertical scrollbars are to be synced.

Can somebody please help me with this issue? I have been trying this for well over a month but with no luck. I'd be grateful to whoever saves me out here!!
Please! HELP!

-
Roger

解决方案

 

Hi Roger,

You can create a custom ListView and override the WinProc to provide a Scroll event for your ListView. You can check the following article for how provide scroll event for your ListView:

·   http://www.devnewsgroups.net/group/microsoft.public.dotnet.framework.windowsforms/topic34807.aspx

When you have finished provide the Scroll event for the ListView, you can handle the Scroll event and send the same message to the second ListView or use the TopItem to sync the two ListView. Here is a sample for your reference:

·   http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3089588&SiteID=1

Hope this helps.
Best regards.
Rong-Chun Zhang


这篇关于同步ListView滚动条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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