Community
Participate
Working Groups
Run the following example. It should draw a dashed line but it draws a solid line. Remove the line "gc.setLineWidth(2);" and you get a dashed line. public static void main(String args[]){ Display display = new Display(); final Shell shell = new Shell (display); shell.addListener(SWT.Paint, new Listener(){ public void handleEvent(Event e){ GC gc = e.gc; gc.setLineWidth(2); gc.setLineStyle(SWT.LINE_DASH); gc.drawLine(0,0,200,200); } }); shell.open(); while (!shell.isDisposed ()) { if (!display.readAndDispatch ()) display.sleep (); } } NOTES:
PRODUCT VERSION: 1.0 137 Windows 2000
*** Bug 28803 has been marked as a duplicate of this bug. ***
Steve, We have tried the EXTLOGPEN in the past and while it fixed this problem it created other problems so we abandoned it. Is it time to retry the EXTLOGPEN?
Yes, we know more now. Before proceding, we should try to remember what caused us to abandon this approach in the past. Perhaps the only way is to try again and rediscover the problems.
I think the problem in the past was that the Ex equivalent of: LOGPEN logPen = new LOGPEN(); OS.GetObject(hPen, LOGPEN.sizeof, logPen); did not return all the values required. As a result, when we changed the width or style, we lost some of the other attributes (such as endcap I think).
We need to try again, post 3.0.
The only workaround is to force line width to be equal to 1. However on high resolution printers the line will be very thin in combination with a line color (which will be dithered), the line can barely be visible sometimes. This should be raised in priority.
Fixed > 20041116.