NET滚动条自动滚动问题

NET滚动条自动滚动问题

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

问题描述

我在使用.NET编写使用自动滚屏在对话框的布局面板的应用程序。
看来,每当我调整,以使垂直滚动条出现在窗口,水平滚动条会自动也会出现。它仔细观察,第二滚动条现在允许我以滚动16像素(其它滚动条的宽度)的窗口。所以Windows似乎觉得我需要一个客户端区域至少是一样宽,它是垂直滚动条出现之前。

I'm writing an app in .net that uses the autoscroll for a layout panel in a dialog.It seems that whenever I resize the window so that the vertical scrollbars should appear, the horizontal scrollbar automatically appears also. Looking closely at it, the second scrollbar now allows me to scroll the window by 16 pixels (the width of the other scrollbar). So windows seems to think I need a client area that is at least as wide as it was before the vertical scrollbar appeared.

如果我现在调整窗口的大小为16像素更广泛的(所以我的窗口区域是一样宽,它是滚动条出现之前),滚动条消失。现在,如果我调整它回落到它是什么,它​​保持了。

If I now resize the window to be 16 pixels wider (so that my window area is as wide as it was before the scrollbar appeared), the scrollbar goes away. Now if I resize it back down to what it was, it stays away.

所以,这样看来,我认为有一个在系统中的错误,其中最小宽度为不知何故黏,但升迁和downsizging窗口(用鼠标,没有tuching滚动条相关的API)清除状态

So it would appear to me that there is a bug in the system where the minimum width is somehow sticky, but upsizing and downsizging the window (with the mouse, and without tuching the scrollbars related APIs) clears the condition

是否有人知道一种解决办法,还是我做一些绊倒的Windows?

Does anybody know of a workaround, or am I doing something to trip up Windows?

推荐答案

是的,我想你已经正确地诊断问题。它是,说,垂直滚动条出现并需要空间,使得可用的客户区小讨厌的副作用。太小,放不下的控件,现在也使水平滚动条出现。它实际上是双稳态,水平杆可以在某些情况下闪烁开启和关闭。

Yes, I think you already diagnosed the problem correctly. It is a nasty side effect of, say, the vertical scrollbar appearing and needing space, making the available client area smaller. Too small to fit the controls, now also making the horizontal scrollbar appear. It is actually bi-stable, the horizontal bar can flicker on and off in certain cases.

要避免这种效果,布局引擎将不得不作出通过多遍布局,应对不断变化的客户区。但是,由于它不仅使一个通道。这听起来明智的,这可能是一个潜在的永无止境的循环。我不知道这个体面的修复。您的用户将很可能只是调整窗口的大小足够大,以摆脱滚动条的至少一个。

To avoid this effect, the layout engine would have to make multiple passes through the layout, dealing with the changing client area. It however only makes one pass. Which sounds wise, this could be a potentially never ending loop. I don't know of a decent fix for this. Your user will probably just resize the window large enough to get rid of at least one of the scrollbars.

这篇关于.NET滚动条自动滚动问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 17:35