[Mono-bugs] [Bug 66665][Nor] New - System.Drawing.Graphics.Draw* fails to use new Pen style after using a dashed Pen.
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Thu, 23 Sep 2004 04:47:13 -0400 (EDT)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by david@quintana.org.
http://bugzilla.ximian.com/show_bug.cgi?id=66665
--- shadow/66665 2004-09-23 04:47:13.000000000 -0400
+++ shadow/66665.tmp.4546 2004-09-23 04:47:13.000000000 -0400
@@ -0,0 +1,85 @@
+Bug#: 66665
+Product: Mono: Class Libraries
+Version: unspecified
+OS: GNU/Linux [Other]
+OS Details: FC2
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: Sys.Drawing.
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: david@quintana.org
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: System.Drawing.Graphics.Draw* fails to use new Pen style after using a dashed Pen.
+
+Description of Problem:
+When drawing with multiple System.Drawing.Pens, each with different
+DashStyles, if one of the DashStyles is dotted, all further Pens are
+treated as dotted, even if they aren't. Below is some test code. The code
+draws a solid black line, a solid black lined rectangle, and then a dotted
+red line. After the dotted line has been draw, all further lines are drawn
+dotted even when explicitly specifying otherwise. Code:
+
+// Testing Dashed Lines under Mono
+
+using System;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+using System.Drawing.Imaging;
+
+public class PenTest
+{
+
+ public static void Main()
+ {
+ float lineWidth = 1;
+
+ Bitmap bImg = new Bitmap( 400, 300 );
+ Graphics graphics = Graphics.FromImage(bImg);
+
+ SolidBrush regularBrush = new SolidBrush(Color.White);
+ Pen regularLine = new Pen(Color.Black,lineWidth);
+ Pen dashedLine = new Pen(Color.Red,lineWidth);
+ dashedLine.DashStyle = DashStyle.Dot;
+
+ //Make a white background
+ graphics.FillRectangle(regularBrush, 0, 0, 400, 300 );
+
+ for (int i=10; i < 300; i=i+20)
+ {
+ // Even explicitly changing the style doesn't work
+ regularLine.DashStyle = DashStyle.Solid;
+
+ graphics.DrawLine(regularLine, 5,i,395,i);
+ graphics.DrawRectangle(regularLine,5,i+5,390,5);
+ graphics.DrawLine(dashedLine, 5,i+15,395,i+15);
+ }
+
+ bImg.Save("pentest.png",ImageFormat.Png);
+
+
+ }
+
+}
+
+
+
+Steps to reproduce the problem:
+1. Compile and Run code above.
+2. Examine pentest.png
+3.
+
+Actual Results:
+All lines after first dashed line are dashed
+
+Expected Results:
+Lines should reflect properties of Pen used to draw them.
+
+How often does this happen?
+Always.
+
+Additional Information: