|How do you set the background image on a Control (in 3.2 M4?) [message #467175]
||Thu, 26 January 2006 04:07
| Edward Kuns
Registered: July 2009
The Snippet showing how to set a background image does so on a Shell, |
but the method itself belongs to Control. When I try (on WinXP) calling
setBackgroundImage() on a button, it does nothing. If I later call
getBackgroundImage() it does return the correct image, but nothing is
I've tried this with 3.2M3, 3.2M4, and a recent Integration build of SWT
and this is the same for all of them. It is as if the
setBackgroundImage() call is totally ignored, except that the button
does know what image is supposed to be on its background.
I run Snippet214 and I do get the background image on the Shell, but I
really want a background image on a Button. Here's the issue: I want
text on top of an image. I know that I can roll my own Image with text
on top of an image, and that works, but when I do this and call
setImage() on the button, the image doesn't fill the whole button.
There is a margin around the image inside the button. I would like an
image that fills the entire button, with text on top of that.
I know that I can draw on the GC of the button to put pretty much
anything I want to on the button, but when I have tried this, as soon as
I click on the button, what was on the GC is thrown away. So that
doesn't seem stable on use of the button. Also, the GC occupies not
only the interior of the button, but also the boundaries of the button
that make it a button. I want an image inside the button, but filling
100% of the button.
Is this possible? Any hints and ideas greatly appreciated.
Powered by FUDForum
. Page generated in 0.01984 seconds