我是swt的新手,我有一个包含图像的Dialog但是如果图像太大则无法看到完整的图像。它被削减了。所以我决定用滚动创建一个Dialog。我做了但滚动不起作用。它出现了,你可以clic over并移动它但我无法移动图像。我尝试过几件事,但没有一件能奏效:(
protected Control createDialogArea(Composite parent) {
//getShell().setText(Messages.labelTitle);
//setTitleImage(image); // Image to be displayed in your Dialog
//return parent;
Composite container = new Composite(getShell(), SWT.H_SCROLL | SWT.V_SCROLL);
container.setLayoutData(new GridData(GridData.FILL_BOTH));
container.setLayout(new GridLayout());
Label preview = new Label(container, SWT.NONE);
GridData layoutData = new GridData(GridData.FILL_BOTH);
preview.setLayoutData(layoutData);
preview.setImage(image);
return parent;
}