Using PathGradientBrush
-
Hello! I have this code: GraphicsPath path1 = new GraphicsPath(); path1.AddEllipse(10,10,100,100); PathGradientBrush brush1 = new PathGradientBrush(path1); brush1.CenterColor = Color.White; Color[] colorArray2 = new Color[] { ScaleColor(Color.White, 0.25f) }; Color[] colorArray1 = colorArray2; brush1.SurroundColors = colorArray1; ----------------------------------------------------------------------------------- public static Color ScaleColor(Color sourceColor, float scale) { int num1 = (int)(sourceColor.R * scale); int num2 = (int)(sourceColor.G * scale); int num3 = (int)(sourceColor.B * scale); if (num1 > 0xff) { num1 = 0xff; } if (num2 > 0xff) { num2 = 0xff; } if (num3 > 0xff) { num3 = 0xff; } return Color.FromArgb(num1, num2, num3); } --------------------------------------------------------------------------------------- this works fine but when i change the size of the ellipse and the width or height is zero my project shows an exception : Out of memory Somebody knows why this happen or why can i do to fix this? Regards, Alberto Martinez