在SWT TableViewer中对齐图像 [英] Align an image in a SWT TableViewer

查看:187
本文介绍了在SWT TableViewer中对齐图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚发现,它在某种程度上不可能在swt tableviewer中对齐一个图像。使用SWT.RIGHT(例如)创建一个TableColumn,如果它的labelprovider为其返回一个图像,则不会影响该列。
问题:是否有其他方式对齐图像而不是修改图像文件本身并放置一些额外的像素?

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?

推荐答案

我相信你遇到了底层平台的限制(或某种事情)。如果您自己绘制,您可以完全控制进入单元格的内容。有一个代码片段显示了如何做到这一点。

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.

表示例片段:在表项的右侧绘制图像

当然,您还必须在单元格中绘制所需的任何文本。

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

这篇关于在SWT TableViewer中对齐图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆