Align an image in a SWT TableViewer

旧街凉风 提交于 2019-12-12 14:22:11

问题


I just found out, that its somehow impossible to align an image in a swt tableviewer. Creating a TableColumn with SWT.RIGHT (for instance) has no effect on that column if its labelprovider returns an image for it. Question: Is there any other way to align an image instead of modifiying the image file itself and put some extra pixel into it?


回答1:


I believe that you're running into a limitation of the underlying platform (or something to that effect). You can have total control over what goes into the cell if you draw it yourself. There is a snippet that shows you how to do this.

Table example snippet: draw images on right side of table item

Of course, you'll also have to draw any text you want in the cell.



来源:https://stackoverflow.com/questions/1410516/align-an-image-in-a-swt-tableviewer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!