SWT Table.setLinesVisible(false) 似乎不适用于 Windows 7 [英] SWT Table.setLinesVisible(false) does not seem to work on Windows 7

查看:33
本文介绍了SWT Table.setLinesVisible(false) 似乎不适用于 Windows 7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们公司正试图将所有人从 Window XP 转移到 Windows 7,所以我正在测试一些本土的 SWT 应用程序,以确保它们仍然可以在 Windows 7 上运行.其中大多数仍然可以,但也有一些奇怪的怪癖.我已经能够解决其中的大部分问题,但这里的一个我不走运.

Our company is trying to move everyone from Window XP to Windows 7, so I'm testing some of the home-grown SWT applications to make sure that they still work on Windows 7. Most of them still do, but there's some weird quirks. I've been able to work out most of them, but the one here I'm having no luck with.

SWT 表似乎总是在列之间有一条难看的黑线.我试过调用 setLinesVisible(false),但无济于事.我知道这似乎不是一个重要的区别,但我们的用户可能非常挑剔.有没有人有将应用程序迁移到 Windows 7 的类似经历,或者对我可以尝试的方法有什么建议?

SWT Tables always seem to have an ugly black line between columns. I've tried calling setLinesVisible(false), but to no avail. I know this doesn't seem like an important difference, but our users can be quite picky. Has anyone had similar experiences of migrating apps to windows 7 or have any suggestions on what I can try?

之前(在 XP 中 - 竖起大拇指):

Before (in XP - thumbs up):

之后(在 Windows 7 中 - 拇指向下 [注意黑线]):

After (in Windows 7 - thumbs down [Notice the black lines]):

有什么建议吗?

推荐答案

尝试将以下侦听器添加到您的表中:

Try adding the following listener to your table:

      //Assuming your table is named 'table' and 'backgroundColor' is the
      //color you're using to paint it's background.
      table.addListener(SWT.EraseItem, new Listener() {
        @Override
        public void handleEvent(Event event) {
          event.gc.setBackground(backgroundColor);
          event.gc.fillRectangle(event.getBounds());
        }
      });


这应该可以解决垂直线的问题.这是它在我的示例表上的外观:


This should solve your problems with vertical lines. Here's how it looks on my example table:

没有监听器(注意垂直线,在我的例子中它们不是黑色的,它们是灰色的......但它们仍然可见):

Without the listener (notice the vertical lines, they are not black in my case, they're gray..but they're still visible):

现在添加监听器:

这篇关于SWT Table.setLinesVisible(false) 似乎不适用于 Windows 7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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