我的问题是,如果我的“滚动复合”
scrolledWrapper.setExpandHorizontal(true);
scrolledWrapper.setExpandVertical(true);
它可以在整个ViewPart上正确展开,但是如果我缩小View,则不会出现滚动条。
如果不设置扩展,则滚动条会出现,但是滚动的复合材料内部的整个复合材料不会扩展。
GridLayout gridLayout = new GridLayout(1, true);
GridData gridData = new GridData(SWT.FILL, SWT.FILL, false, false);
ScrolledComposite scrolledWrapper = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
scrolledWrapper.setLayout(gridLayout);
// if set the scrollbars dont appear but the composite expand on the whole view
scrolledWrapper.setExpandHorizontal(true);
scrolledWrapper.setExpandVertical(true);
scrolledWrapper.setLayoutData(gridData);
scrolledWrapper.setBackground(Display.getCurrent().getSystemColor(BG_COLOR));
有人知道我可以如何将Composite设置为在整个视图上展开,同时在视图缩小时也显示滚动条吗?
我找到了一个解决方案:
您需要设置最小尺寸。复合材料需要知道小到什么尺寸
scrolledWrapper.setMinSize(wrapper.computeSize(SWT.DEFAULT, SWT.DEFAULT));
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句