Bug 4853 - GC.setLineStyle does not work if width > 1 (1GKZ18N) [portability]
Summary: GC.setLineStyle does not work if width > 1 (1GKZ18N) [portability]
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 2.0   Edit
Hardware: All Windows 2000
: P2 normal with 5 votes (vote)
Target Milestone: ---   Edit
Assignee: Silenio Quarti CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 28803 (view as bug list)
Depends on:
Blocks:
 
Reported: 2001-10-11 14:24 EDT by Veronika Irvine CLA
Modified: 2009-08-17 11:36 EDT (History)
9 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Veronika Irvine CLA 2001-10-11 14:24:12 EDT
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:
Comment 1 DJ Houghton CLA 2001-10-29 16:43:46 EST
PRODUCT VERSION:

1.0 137
Windows 2000

Comment 2 Steve Northover CLA 2003-01-02 12:30:29 EST
*** Bug 28803 has been marked as a duplicate of this bug. ***
Comment 3 Veronika Irvine CLA 2004-02-05 10:04:58 EST
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?
Comment 4 Steve Northover CLA 2004-02-10 13:10:49 EST
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.
Comment 5 Veronika Irvine CLA 2004-02-10 13:31:02 EST
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).
Comment 6 Steve Northover CLA 2004-05-10 10:15:58 EDT
We need to try again, post 3.0.
Comment 7 Steven R. Shaw CLA 2004-10-26 12:21:05 EDT
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.
Comment 8 Silenio Quarti CLA 2004-11-16 14:17:51 EST
Fixed > 20041116.