Button b=new Button(shell,SWT.PUSH);
b.setBackground(new Color(display,new RGB(0,0,255)));
为什么这样设置不正确啊,应该如何设置按扭的背景色啊??

解决方案 »

  1.   

    我想这可能与组件的透明度有关系,但如何在swt中设置成不透明呢.
    但这里我又有点想法的是,像swt里都是重型组件,重型组件应该都是不透明的吧.
    大哥大姐们,快来帮我解答疑惑啊.
      

  2.   

    see the source of Button class, note it's method createHandle.void createHandle () {
    super.createHandle ();
    if ((style & SWT.PUSH) == 0) state |= THEME_BACKGROUND;
    if (OS.COMCTL32_MAJOR >= 6) {
    if ((style & SWT.RADIO) != 0) state |= DRAW_BACKGROUND;
    }
    }
      

  3.   

    http://dev.eclipse.org/newslists/news.eclipse.platform.swt/msg19914.html
      

  4.   

    我看了一会儿Control 的代码,但还是有些地方不太明白.
    真是谢谢你了.
      

  5.   

    难道我现在要做到这一点,
    那只好用gc.fillRect()来画出的背景吗?