如何阻止滚动列表框? [英] How can I stop a list-box from scrolling?

查看:77
本文介绍了如何阻止滚动列表框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个多选列表框。用户可以从列表框A中进行选择,然后单击按钮将选择项移动到列表框B.问题是当列表框A被重新查询时,选择消失列表框A坚持向下滚动这样它只显示列表中的最后一项。我真的不想让它滚动,但如果它必须我会宁愿滚动回显示第一项,而不是最后一项。


我可以'找不到任何方法或属性,允许我在运行时通过代码控制列表框的滚动行为(或任何其他时间,来到那里!)


A进一步(但不那么重要,只有化妆品)的问题是,如果你然后滚动列表框A回到顶部,列表项之间有很多''artefact''划分线,看起来很奇怪和杂乱。


我很感激你能解决这些问题。

I have two multi-select list boxes. The user can make a selection from list-box A, and click a button to move the selection into list-box B. The problem is that when list-box A is requeried so that the selection disappears list-box A insists on scrolling down so that it shows only the last items in the list. I really don''t want it to scroll at all, but if it must I''d rather it scrolled back to showing the first items, not the last.

I can''t find any methods or properties to allow me to control the scrolling behaviour of a list-box through code at run-time (or any other time, come to that!)

A further (but less vital, only cosmetic) problem is that if you then scroll list-box A back to the top there are a lot of ''artefact'' dividing lines between the list items, which looks very odd and messy.

I''d be grateful for any light you can shed on these matters.

推荐答案

为了论证,让我们说你的列表框名为List1。紧跟在Requeries List1之后的下面的代码将自动转到列表框的顶部并选择第一项:
For the sake of argument, let''s say that your List Box is named List1. The following code, placed immediately after after the line that Requeries List1, will automatically go to the top of the List Box and select the 1st item:
展开 | 选择 | 换行 | 行号


遗憾的是,这仅适用于非多选列表框。多选的没有这个简单的ListIndex属性。但是,谢谢你试一试!我将继续思考...
Sadly, this works only for non-multiselect list boxes. Multiselect ones don''t have this nice simple ListIndex property. But thank you for a having a try at it! I will continue to ponder ...


如果您重新查询列表框A可以解决您的问题。
If you requery the listbox A does that solve your problem.


这篇关于如何阻止滚动列表框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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