Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
即使没有可滚动的内容,是否可以始终显示 VerticalBar?
ScrolledComposite sc = new ScrolledComposite(main, SWT.BORDER_SOLID| SWT.V_SCROLL);
这行代码并不总是打开滚动。
对于 ScrolledComposite,我认为您不能这样做,至少如果您想正常使用 H 滚动功能。您可以调用ScrolledComposite.setAlwaysShowScrollbars()true,但它会一直显示两个启用的滚动条。(通过在选项中设置 SWT.H_SCROLL 或 SWT.V_SCROLL 来启用它们)。如果您不想要水平滚动,那么这将满足您的需求。
ScrolledComposite.setAlwaysShowScrollbars()