2009-01-02 Ivan N. Zlatev <contact@i-nz.net>
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / ThemeVisualStyles.cs
index 4701e15bd4f97920aa377571154fb0885e5ced00..33d9b6662adcfc1932cff436467deec7395e4618 100644 (file)
@@ -1160,6 +1160,7 @@ namespace System.Windows.Forms
 #endif
                        default: // Blocks
                                int block_width = renderer.GetInteger (IntegerProperty.ProgressChunkSize);
+                               block_width = Math.Max (block_width, 0); // block_width is used to break out the loop below, it must be >= 0!
                                int first_pixel_outside_filled_area = (int)(((double)(ctrl.Value - ctrl.Minimum) * client_area.Width) / (Math.Max (ctrl.Maximum - ctrl.Minimum, 1))) + client_area.X;
                                int block_count = 0;
                                int increment = block_width + renderer.GetInteger (IntegerProperty.ProgressSpaceSize);
@@ -1738,7 +1739,7 @@ namespace System.Windows.Forms
                                base.ToolTipDrawBackground (dc, clip_rectangle, control);
                                return;
                        }
-                       new VisualStyleRenderer (element).DrawBackground (dc, control.Bounds);
+                       new VisualStyleRenderer (element).DrawBackground (dc, control.ClientRectangle);
                }
                public override bool ToolTipTransparentBackground {
                        get {