50,526
社区成员
发帖
与我相关
我的任务
分享
@Override
public void paintControl(PaintEvent event) {
GC gc = event.gc;
gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_RED));
if (hover)
gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_YELLOW));
gc.fillRectangle(0, 0, event.width, event.height);
//
gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WHITE));
gc.drawLine(0, event.height - 1, event.width, event.height - 1);
//
gc.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
gc.drawString("aaa", 5, 5, true);
gc.dispose();
}
@Override
public void paintControl(PaintEvent event) {
Rectangle rec=getBounds();
GC gc = event.gc;
gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_RED));
if (hover)
gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_YELLOW));
gc.fillRectangle(0, 0, rec.width, rec.height);
//
gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WHITE));
gc.drawLine(0, rec.height - 1, rec.width, rec.height - 1);
//
gc.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
gc.drawString("aaa", 5, 5, true);
gc.dispose();
}