I’m not sure if this is a bug or a feature…
When I use a linearGradientBrush and then try to draw text afterwards, the text takes on the gradient, rather than its own colour.
Using the gradient example code:
Var linearBrush As New LinearGradientBrush
linearBrush.StartPoint = New Point(0, 0)
linearBrush.EndPoint = New Point(g.Width, g.Height)
linearBrush.GradientStops.Add(New Pair(0, Color.Red))
linearBrush.GradientStops.Add(New Pair(0.4, Color.Yellow))
linearBrush.GradientStops.Add(New Pair(0.7, Color.Magenta))
linearBrush.GradientStops.Add(New Pair(1.0, Color.Blue))
g.Brush = linearBrush
g.FillOval(0, 0, g.Width/2, g.Height/2)
g.DrawingColor = Color.blue
g.FontSize = 20
Var s As String = "The quick brown fox jumps over the lazy dogs tail"
g.DrawText(s,20,30)
g.Brush = linearBrush
g.FillOval(0, 0, g.Width/2, g.Height/2)
g.Brush = Nil
g.DrawingColor = Color.Blue
g.FontSize = 20
Var s As String = "The quick brown fox jumps over the lazy dogs tail"
g.DrawText(s, 20, 30)
Someone should file a ticket though. I too would have expected setting a solid color to override the brush (the way that choosing a solid color changes the gradient fill in most photo editing software).
A case should be created for this. It may actually be a bug, but even if it needs a doc change a case makes it easier to assign and track since I don’t handle every doc update.
OP had set a solid color after using the brush. Imagine if your photo editing software was still using the previous gradient selection after you’d selected a solid color. Why would it not be a bug?
The framework should work for us, extra steps like “you must nil the brush even after you set a solid color” aren’t good for Rapid App Development.
Update: Changed “even if” to “even after” for clarity in what the issue is.