public void SetFunctionId()
        {
            currentExample = Examples[currentFunctionId];
            StringFormat SF = new StringFormat()
            {
                Alignment     = StringAlignment.Center,
                LineAlignment = StringAlignment.Center
            };

            polynomialDisplay.PrepareWrite();
            polynomialDisplay.gfx.DrawString(currentExample.functionString, new Font("Arial Black", 10), Brushes.Black, polynomialDisplay.Rect.Width / 2, polynomialDisplay.Rect.Height / 2, SF);
            polynomialDisplay.PrepareDraw();

            parser.InputString = currentExample.functionString;
            parser.Parse();
            FunctionFractalWindow.Controller.CoefficientArray = parser.CoefficientArray;
            FunctionFractalWindow.Controller.Compute();
            for (int i = 0; i < ExampleLocationWindows.Length; i++)
            {
                if (currentExample.exampleLocations.Count > i)
                {
                    int j = (i + currentLocationOffsetId) % currentExample.exampleLocations.Count;
                    ExampleLocationWindows[i].Controller.CoefficientArray = parser.CoefficientArray;
                    ExampleLocationWindows[i].Controller.CameraPos        = currentExample.exampleLocations[j].position;
                    ExampleLocationWindows[i].Controller.Zoom             = currentExample.exampleLocations[j].zoom;
                    ExampleLocationWindows[i].Controller.Iterations       = currentExample.exampleLocations[j].iter;
                    ExampleLocationWindows[i].Controller.Compute();
                    ExampleLocationWindows[i].Enabled = true;
                }
                else
                {
                    ExampleLocationWindows[i].Enabled = false;
                }
            }
        }
        public ExampleLocationComponent(float x, float y, AutoZoomController zoomController, Main M) : base(new RectangleF(x, y, Width, Height))
        {
            this.M = M;
            this.zoomController = zoomController;
            string Data = Resources.ExampleLocations;

            string[] lines = Data.Split(new string[] { "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries);

            List <ExampleLocationStructs> locations = new List <ExampleLocationStructs>();

            for (int i = lines.Length - 1; i >= 0; i--)
            {
                string[] parts = lines[i].Split(':');
                if (parts[0] == "function")
                {
                    var exampleFunction = new ExampleFunctionStruct();
                    exampleFunction.exampleLocations = locations;
                    exampleFunction.functionString   = parts[1];
                    locations = new List <ExampleLocationStructs>();
                    Examples.Insert(0, exampleFunction);
                }
                else if (parts[0] == "location")
                {
                    var      exampleLocation = new ExampleLocationStructs();
                    string[] locationParts   = parts[1].Split('|');
                    exampleLocation.position = new Complex();
                    if (!double.TryParse(locationParts[0], out exampleLocation.position.real))
                    {
                        Console.WriteLine(locationParts[0] + " is not a valid double");
                        break;
                    }
                    if (!double.TryParse(locationParts[1], out exampleLocation.position.imag))
                    {
                        Console.WriteLine(locationParts[1] + " is not a valid double");
                        break;
                    }
                    if (!double.TryParse(locationParts[2], out exampleLocation.zoom))
                    {
                        Console.WriteLine(locationParts[2] + " is not a valid double");
                        break;
                    }
                    if (!int.TryParse(locationParts[3], out exampleLocation.iter))
                    {
                        Console.WriteLine(locationParts[3] + " is not a valid integer");
                        break;
                    }
                    locations.Add(exampleLocation);
                }
                else
                {
                    Console.WriteLine(parts[0] + " is not a valid modifier");
                    break;
                }
            }
            for (int i = 0; i < ExampleLocationWindows.Length; i++)
            {
                ExampleLocationWindows[i] = new FractalWindow(new RectangleF(10 + SideButtonWidth + (FractalWindowSize + 10) * i, FractalWindowSize + 32, FractalWindowSize, FractalWindowSize));
                ChildElements.Add(ExampleLocationWindows[i]);
                ExampleLocationWindows[i].EnableInteraction = false;
                ExampleLocationWindows[i].MouseDownEvent   += FractalWindowClick;
            }

            int X = (FractalWindowSize + 10) * (ExampleLocationWindows.Length - 1);

            FunctionFractalWindow = new FractalWindow(new RectangleF(10 + SideButtonWidth + X, 10, FractalWindowSize, FractalWindowSize));
            FunctionFractalWindow.EnableInteraction = false;
            FunctionFractalWindow.MouseDownEvent   += FractalWindowClick;
            ChildElements.Add(FunctionFractalWindow);
            polynomialDisplay = new TextDisplay(new RectangleF(10 + SideButtonWidth, 10, X - 10, FractalWindowSize));
            polynomialDisplay.PrepareDraw();
            ChildElements.Add(polynomialDisplay);
            currentExample  = Examples[0];
            MouseDownEvent += MainWindowClicked;
        }