How to modify the width or height of TableItem in pixels #1539
-
I can simply modify the width and height of TableItem through the code below
but it only works in points, and I just want to know how to make it work in pixels. As for Table, although it also can't do this by "Public" method, but can be achieved by using reflection. Can anyone help me ,thanks very much! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 10 replies
-
I believe you can't directly set sizes in pixels in SWT. By default, it uses points, which adjust based on the display's DPI. To get pixel sizes, you need to manually do may be, pixel conversions and apply some sort of scaling or so.. As far as I know, there's no API that automatically switches between points and pixels, but please do correct me if I'm mistaken. |
Beta Was this translation helpful? Give feedback.
@pcdlrzxx
Yes you right. We went with 25% increments initially and it created lots of problems with the sizes. Converting pixels to points using integer arithmetic is bound cause trouble. Thats why we had to completely remove 25% increments and then supported integer scale factors only.
By the way Mac uses floating point arithmetic and Linux supports only integer scaling factors.