[Mono-bugs] [Bug 82838][Nor] New - Passing Rectangle.Empty to Control.Invalidate(Rectangle) should draw the entire control

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Sep 13 10:52:41 EDT 2007


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 brock.reeve at ni.com.

http://bugzilla.ximian.com/show_bug.cgi?id=82838

--- shadow/82838	2007-09-13 10:52:41.000000000 -0400
+++ shadow/82838.tmp.15947	2007-09-13 10:52:41.000000000 -0400
@@ -0,0 +1,74 @@
+Bug#: 82838
+Product: Mono: Class Libraries
+Version: 1.2
+OS: SUSE 9.2
+OS Details: using openSUSE 10.2
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Windows.Forms
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: brock.reeve at ni.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Passing Rectangle.Empty to Control.Invalidate(Rectangle) should draw the entire control
+
+Description of Problem:
+
+I am using latest MONO 1.2.5
+
+On windows (non-mono), if you pass Rectangle.Empty to Control.Invalidate 
+windows generates a paint message with the bounds of the entire control, 
+so the entire control is drawn. Running MONO (any OS), if you pass 
+Rectangle.Empty no paint message is generated.
+
+There is an easy workaround where you just pass the bounds in. I am just 
+reporting this as an inconsistancy between the two (we found this when 
+trying to port some of our custom windows forms Controls and finding that 
+some would refuse to redraw in MONO).
+
+
+Steps to reproduce the problem:
+1. Create a new windows forms application using VS2005
+2. Add a button to the bottom portion of the form and click on it
+3. Delete the contents of the form class and paste the following instead:
+
+private int _num;
+
+        public Form1()
+        {
+            InitializeComponent();
+            _num = 0;
+        }
+
+        private GraphicsPath CreatePath()
+        {
+            GraphicsPath path = new GraphicsPath();
+            path.AddEllipse(new Rectangle(20, 20, 100, 100));
+            return path;
+        }
+
+        protected override void OnPaint(PaintEventArgs e)
+        {
+            base.OnPaint(e);
+            
+            _num++;
+            using (GraphicsPath path = CreatePath())
+            {
+                if(_num % 2 == 0)
+                    e.Graphics.FillPath(Brushes.Red, path);
+                else
+                    e.Graphics.FillPath(Brushes.Green, path);
+            }
+        }
+
+        private void button1_Click(object sender, EventArgs e)
+        {
+            Invalidate(Rectangle.Empty);
+        }
+
+4. Run and click on the button. Notice the circle alternates colors. Now 
+run against MONO (Any OS). Notice clicking the button does nothing.


More information about the mono-bugs mailing list