如何调整滚动合成的大小以始终使其内容水平放置? [英] How to resize a scroll composite to always fit its contents horizontally?

查看:64
本文介绍了如何调整滚动合成的大小以始终使其内容水平放置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个滚动的复合文件,其中包含一个tableViewer。
我的要求是,如果表格的宽度增加,则滚动组合不应显示水平滚动,而应扩展为适合表格的大小。
我在此处使用滚动复合的唯一原因是我想显示垂直滚动条。

I have a scrolled composite ,it contains a tableViewer. My requirement is that if the table is increased in width,the scroll composite should not show horizontal scroll ,but it should expand to fit table's size. The only reason I have used a scrolled composite here is I want to show vertical scroll bar.

推荐答案

如果想要在SWT中控制的滚动条-这是 Scrollable 的子类-只需添加一个或构造函数中的以下更多样式。如果构造了Viewer,则使用相同的样式。

If you want to control the scrollbars of a Table in SWT - which is a sub-class of Scrollable - simply add one or more of the following styles in the constructor. If you construct a Viewer, the same styles are used.

SWT.H_SCROLL


水平滚动条行为的样式常量

Style constant for horizontal scrollbar behavior

SWT.V_SCROLL


垂直滚动条行为的样式常量

Style constant for vertical scrollbar behavior

SWT.NO_SCROLL


没有滚动条行为的样式常量

Style constant for no scrollbar behavior

未指定H_SCROLL或V_SCROLL时,控件可以自由创建控件的默认滚动条。使用NO_SCROLL会覆盖默认值,并强制控件没有滚动条。

When neither H_SCROLL or V_SCROLL are specified, controls are free to create the default scroll bars for the control. Using NO_SCROLL overrides the default and forces the control to have no scroll bars.

这篇关于如何调整滚动合成的大小以始终使其内容水平放置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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