Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How to get the size of a composite
How to get the size of a composite [message #460429] Fri, 26 August 2005 08:30 Go to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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!
Previous Topic:Proper display of Excel OLE object in view
Next Topic:How to print a formpage?
Goto Forum:
  


Current Time: Thu Apr 25 08:17:34 GMT 2024

Powered by FUDForum. Page generated in 0.03394 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top