2

I have a NO_TRIM shell with rounded corners, created by applying a Region. The problem is, I'd like the edges of the shell to be anti-aliased, which I don't know how to do with applying a Region or any other way.

Right now I have this:

shell.addPaintListener(new PaintListener() {
    public void paintControl(PaintEvent e) {
        setRoundedShape(shell, 10);
    }
});

//...

void setRoundedShape(Control control, int r) {
    Region region = new Region(control.getDisplay());
    // ...
    control.setRegion(region);
    region.dispose();
}

I know about GC.setAntialias(SWT.ON) but I don't see how to use it to shape a control. Please help...

Baz
  • 36,440
  • 11
  • 68
  • 94
Eugene Marin
  • 1,706
  • 3
  • 23
  • 35
  • Have you tried setting the anti-alias on paintControl you can set the anti-alias to GC with e.gc.setAntiAlias(SWT.ON). – Gorkem Ercan Jun 24 '13 at 02:22
  • Like I said, I can set anti-alias in gc but I don't use the gc object here. If I could use it to shape the control outline, I'd like to know how. – Eugene Marin Jun 27 '13 at 05:43
  • You are not using the GC but it is possible that on some platforms the same GC instance is used (with the flags you have passed) to draw the Control by the platform. – Gorkem Ercan Jun 28 '13 at 18:50
  • Unfortunately no effect... thnx for trying though :) I'm onto a possible trick, but it's pretty complicated and perhaps works only on some platforms - extending the shell top to client area making it transparent, then drawing shapes on it with light colors. I'll post an answer if it works. – Eugene Marin Jul 11 '13 at 21:10
  • This client area thing works - only with NO_TRIM shells and only with Anti-alias ON. Disadvantages: existing objects on the shell now appear strange, better draw everything yourself using that GC. – Eugene Marin Jul 11 '13 at 21:26

0 Answers0