swt的Canvas添加了滚动也不能滚动
图片大于画布大小,所以我添加了滚动条,但是滚动没效果Canvascanvas=newCanvas(scrolledComposite,SWT.BORDER|SWT.H_S...
图片大于画布大小,所以我添加了滚动条,但是滚动没效果
Canvas canvas = new Canvas(scrolledComposite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
scrolledComposite.setContent(canvas);
scrolledComposite.setMinSize(canvas.computeSize(SWT.DEFAULT, SWT.DEFAULT));
canvas.setSize(1000, 1000);
canvas.addPaintListener(new PaintListener(){
public void paintControl(PaintEvent e)
{
Image temp = new Image(Display.getCurrent(),"C:/test0.jpg");
e.gc.drawImage(temp, 10, 10);
}
}); 展开
Canvas canvas = new Canvas(scrolledComposite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
scrolledComposite.setContent(canvas);
scrolledComposite.setMinSize(canvas.computeSize(SWT.DEFAULT, SWT.DEFAULT));
canvas.setSize(1000, 1000);
canvas.addPaintListener(new PaintListener(){
public void paintControl(PaintEvent e)
{
Image temp = new Image(Display.getCurrent(),"C:/test0.jpg");
e.gc.drawImage(temp, 10, 10);
}
}); 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询