如何修复无法将最后一个元素滚动到视图中的Excel列表框 [英] How to fix an Excel listbox that can't scroll the last element into view

查看:201
本文介绍了如何修复无法将最后一个元素滚动到视图中的Excel列表框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只要我记得,就是使用列表框滚动。



当您在列表框中有更多的元素时,可以显示,将出现一个棒棒。然而,在某些情况下,将条形滚动到列表的底部并释放它,将向上一个小口向上,您将无法看到列表中的最后一个项目。这里说明如下:



有很多论坛帖子介绍这个问题,解决方案一直是将积分高度属性设置为false,然后再将其设置为true。这样做会稍微调整列表框的大小,使其高度四舍五入到单个行的高度,然后没有任何项目被隐藏。

 与lstbox 
.IntegralHeight = False
.Height = myHeight
.IntegralHeight = True
结束
pre>

然而,在某些情况下,这不起作用。如果您是:


  1. 以编程方式设置列表框的高度

  2. NOT 使用简单的列表框选择(fmMultiSelectSingle)

然后简单地将集成高度设置为false,然后在height之后或之间改变为true调整您的列表框的高度,但是当您向下滚动时,问题仍然存在 - 最后一个项目不能被看到。



这个令人沮丧的问题的关键是互联网上的所有其他人都在确认整体式解决方案为他们工作,这些非常特殊的情况令人沮丧,想知道为什么它不适合他们。那么他们如何得到他们的解决方案?

解决方案

我必须为自己找到什么,哪些不能在别的地方找到是为什么我在这里发布),是这个问题的附加维度依赖于选择方法。虽然我不能理解滚动条的工作方式不仅与高度和整体高度属性有关,而且与.MultiSelect属性有关,我发现它是。



当上面显示的.IntegralHeight方法不起作用时,以下方法将以某种方式进行:

 使用lstbox 
。 IntegralHeight = False
.Height = myHeight
.IntegralHeight = True
.MultiSelect = fmMultiSelectSingle
.MultiSelect = fmMultiSelectExtended
结束

通过简单地将.MultiSelect属性更改为fmMultiSelectSingle,然后将其还原到所需的选择样式,列表框的高度将被自动调整通过.IntegralHeight属性与不执行这些操作的高度略有不同 - 区别导致滚动条正常工作:





我希望发现这种特殊情况和更准确的解决方法可以节省人们不得不经历的几个小时的沮丧和实验。


A killer problem I've had in excel UIs since as long as I can remember, is with listbox scrolling.

When you have more elements in a listbox that can be displayed, a scoll bar will appear. In certain conditions, however, scrolling the bar all the way to the bottom of the list and releasing it, will "jump" the bar a notch upwards, and you won't be able to see the last item in the list. This is illustrated here:

There are many forum posts presenting this issue, and the solution has always been "Set the integral height property to false, and then set it to true again." What this does is slightly resize the listbox so that it the height is rounded to the height of a single row, and then no items are left hidden.

With lstbox
    .IntegralHeight = False
    .Height = myHeight
    .IntegralHeight = True
End With

There are certain cases, however, where this does not work. If you are:

  1. Programatically setting the height of your listbox
  2. NOT using simple listbox selection (fmMultiSelectSingle)

Then simply setting integral height to false and then true after or between changes to height will make an adjustment to the height of your listbox, but when you go to scroll down, the problem will remain - the last item cannot be seen.

The key to this frustrating question is that while everyone else on the internet is confirming that the 'integralHeight' solution works for them, these very special cases are frustrated wondering why it doesn't work for them. So how do they get their fix?

解决方案

Something I had to discover for myself, and which cannot be found anywhere else (which is why I'm posting it here), is that this problem had the added dimension of being dependent on the selection method. While I cannot fathom how the way the scroll bar works is related to not only the height and integral height property, but also the .MultiSelect property, I have found that it is.

When the .IntegralHeight method shown above does not work, the following method somehow does:

With lstbox
    .IntegralHeight = False
    .Height = myHeight
    .IntegralHeight = True
    .MultiSelect = fmMultiSelectSingle
    .MultiSelect = fmMultiSelectExtended
End With

By simply changing the .MultiSelect property to fmMultiSelectSingle, and then restoring it back to the selection style desired, the height of the listbox will be automatically adjusted by the .IntegralHeight property to a slightly different height than when these actions aren't performed - the difference results in the scroll bar working correctly:

I hope the discovery of this special case and more precise workaround saves someone the hours of frustration and experimentation I had to go through.

这篇关于如何修复无法将最后一个元素滚动到视图中的Excel列表框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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