How to get the size of a composite [message #460429] |
Fri, 26 August 2005 08:30 |
Eclipse User |
|
|
|
Originally posted by: katharinas_mail.gmx.de
Hi,
I'm trying to place an image on a composite so that it matches the size.=
=
The composite is part of a sashform, therefore the image should =
increase/decrease its size if the sash is moved.
So far, I tried this, but it doesn't seem to be the right way to get the=
=
width and height of a composite:
int width =3D show.getSize().x;
int height =3D show.getSize().y;
final Image img =3D new Image(UserInterface.display, "pictures/pic.jpg")=
;
final Image scimg =3D new Image(Display.getCurrent(), =
img.getImageData().scaledTo(width, height));
Any suggestions?
Thanks
|
|
|
Re: How to get the size of a composite [message #460432 is a reply to message #460429] |
Fri, 26 August 2005 09:47 |
Eclipse User |
|
|
|
Originally posted by: john.obyrne.gmail.com
Use this instead:
Rectangle clientRect = yourcomposite.getClientArea();
because getSize() takes into account the non client area (borders for
example)
"Karei" <katharinas_mail@gmx.de> wrote in message
news:opsv3wlbwctt899o@katlab.rpl.local...
Hi,
I'm trying to place an image on a composite so that it matches the size.
The composite is part of a sashform, therefore the image should
increase/decrease its size if the sash is moved.
So far, I tried this, but it doesn't seem to be the right way to get the
width and height of a composite:
int width = show.getSize().x;
int height = show.getSize().y;
final Image img = new Image(UserInterface.display, "pictures/pic.jpg");
final Image scimg = new Image(Display.getCurrent(),
img.getImageData().scaledTo(width, height));
Any suggestions?
Thanks
|
|
|
Re: How to get the size of a composite [message #460456 is a reply to message #460432] |
Sat, 27 August 2005 12:47 |
Eclipse User |
|
|
|
Originally posted by: katharinas_mail.gmx.de
> Use this instead:
> Rectangle clientRect =3D yourcomposite.getClientArea();
>
> because getSize() takes into account the non client area (borders for
> example)
okay, thanks a lot!
|
|
|
Powered by
FUDForum. Page generated in 0.03341 seconds