public MandelDisplay()
        {
            // Initialize the control
            InitializeComponent();

            // Initialiaze some fields
            currArea = new MandelAreaArgs();
            calcedArea = new MandelAreaArgs();
            mandelNumbers = null;
            img = null;
            calculating = false;
            mandelNumberToColor = defaultMandelNumberToColor;

            // Create and attach the mandelbrot calculator
            mandelbrot = new Mandelbrot();
            mandelbrot.OnCalculationDone = onMandelbrotDoneHandler;
            this.Controls.Add(mandelbrot);

            // Connect the event handlers
            this.Paint += this.paint;

            // Some properties of the control
            this.ResizeRedraw = true;
        }
        public void SetMandelNumberToColorFunc(MandelNumberToColor f)
        {
            // Remember the function
            mandelNumberToColor = f;

            // Calculate the color map
            colorMap = new Color[calcedArea.MaxIterations + 1];
            for(int i = 0; i <= calcedArea.MaxIterations; ++i)
                colorMap[i] = mandelNumberToColor(i, calcedArea.MaxIterations);
        }