RadialGradientBrush and maximum size

Hi,

I’m playing with the RadialGradientBrush and trying to understand how to compute limitations of it.
Based on the example in the language reference, I’ve put this code in the Paint event of a brand new project’s main window:

Var radialBrush As New RadialGradientBrush
radialBrush.StartPoint = New Point(g.Width / 2, g.Height / 2)
radialBrush.EndPoint=new Point(0,0)
radialBrush.GradientStops.Add(New Pair(0, Color.Green))
radialBrush.GradientStops.Add(New Pair(0.5, Color.Blue))
radialBrush.GradientStops.Add(New Pair(0.8, Color.Red))
radialBrush.StartRadius = 100
radialBrush.EndRadius = 500
g.Brush = radialBrush
g.FillRectangle 0,0,g.Width,g.Height
self.Title=str(g.Width)+"; "+str(g.Height)+"; "+str(Sqrt((g.Width*g.Width)+(g.Height*g.Height)))

The last line is for debugging and shows the width, height and diagonal size of the graphics.
When the diagonal of the window exceeds 800 (whatever the width or height are individually), the painting is done “weird” with only the leftmost up quarter of the window being filled.
I want to allow the user to input values (start point, end point, radiuses) but not allow this “weird” result.

If I could understand why 800 is the diagonal limit with the code above, I could then prevent wrong values for start/end points and radiuses by reversing the formula. But I hit my own understanding limits.

Help welcome.

On Mac or the other thing?

i think you mean if the length from start to end is greater the radius it looks ugly. (like a cone)

On Mac, yes.

It looks like a cone, indeed.
But getting 800 between the start and the end, this is certainly one thing I’m not sure. Here’s the result I’m getting (note the parameters in the title bar):

Thank you.