透明SWT画布 [英] Transparent SWT Canvas

查看:43
本文介绍了透明SWT画布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使SWT画布的背景透明,以便可以在其后面看到其他小部件.

I would like to make the background of an SWT Canvas transparent, so that other widgets can be seen behind it.

我尝试将alpha设置为0,并用矩形填充画布,还使用选项SWT.NO_BACKGROUND无效.

I have tried setting alpha to 0 and filling the canvas with a rectangle and also using the option SWT.NO_BACKGROUND to no avail.

推荐答案

AFAIK,SWT不可能以这种方式(以跨平台方式)将小部件彼此放在顶部.透明的背景将不允许看到其他小部件.此外,对透明像素的任何点击都不会委派给后面的小部件.

AFAIK, it is not possible with SWT to place widgets on top of each other in this way (in a cross-platform manner). Transparent backgrounds won't allow other widgets to be seen. Also any clicks on the transparent pixels won't be delegated to the widgets behind.

但是您可以将壳彼此叠放.您可以创建透明壳或具有不规则边界的壳.请参见片段中的Shell示例.这是不一样的,但是取决于您要实现的目标,就足够了.

But you can place shells on top of each other. And you can create transparent shells or shells with irregular bounds. See the Shell examples in the Snippets. This is not the same, but depending on what you want to achieve, it might suffice.

这篇关于透明SWT画布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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