G
Guest
Hello
I found an abnormal behaviour on LinearGradientBrush (or FillRectangle).
This code
Public Class PanelPanel
Inherits System.Windows.Forms.Panel
Protected Overrides Sub OnPaint(ByVal e As
System.Windows.Forms.PaintEventArgs)
Dim rect As System.Drawing.Rectangle = New
System.Drawing.Rectangle(10, 10, Me.Width - 20, Me.Height - 20)
Dim gradientBrush As System.Drawing.Drawing2D.LinearGradientBrush
gradientBrush = New System.Drawing.Drawing2D.LinearGradientBrush(rect, _
System.Drawing.Color.Gray, _
System.Drawing.Color.FloralWhite, _
System.Drawing.Drawing2D.LinearGradientMode.Vertical)
e.Graphics.FillRectangle(gradientBrush, rect)
End Sub
End Class
generates a control with an rectangle drawn inside.
The problem is that an unusual line (colored Color.FloralWhite) appears on
the top edge of the rectangle. This line should not be there.
If LinearGradientMode id other than Vertical the problem persists, but it is
less visible (only a small colored pixel is visible).
Please note that the anomaly appears only with some rectangle sizes. Example:
if rect={X=10,Y=10,Width=304,Height=208} 'equivalent to a Me.Size=New
Size(324,228) - Anomaly visible
if rect={X=10,Y=10,Width=304,Height=216} 'Correct, anomaly not visible
Could someone PLEASE try to reproduce the problem (just copy code as is) and
confirm that is an error and then reason with me??
Thank you!.
Carlo
(MCP)
I found an abnormal behaviour on LinearGradientBrush (or FillRectangle).
This code
Public Class PanelPanel
Inherits System.Windows.Forms.Panel
Protected Overrides Sub OnPaint(ByVal e As
System.Windows.Forms.PaintEventArgs)
Dim rect As System.Drawing.Rectangle = New
System.Drawing.Rectangle(10, 10, Me.Width - 20, Me.Height - 20)
Dim gradientBrush As System.Drawing.Drawing2D.LinearGradientBrush
gradientBrush = New System.Drawing.Drawing2D.LinearGradientBrush(rect, _
System.Drawing.Color.Gray, _
System.Drawing.Color.FloralWhite, _
System.Drawing.Drawing2D.LinearGradientMode.Vertical)
e.Graphics.FillRectangle(gradientBrush, rect)
End Sub
End Class
generates a control with an rectangle drawn inside.
The problem is that an unusual line (colored Color.FloralWhite) appears on
the top edge of the rectangle. This line should not be there.
If LinearGradientMode id other than Vertical the problem persists, but it is
less visible (only a small colored pixel is visible).
Please note that the anomaly appears only with some rectangle sizes. Example:
if rect={X=10,Y=10,Width=304,Height=208} 'equivalent to a Me.Size=New
Size(324,228) - Anomaly visible
if rect={X=10,Y=10,Width=304,Height=216} 'Correct, anomaly not visible
Could someone PLEASE try to reproduce the problem (just copy code as is) and
confirm that is an error and then reason with me??
Thank you!.
Carlo
(MCP)