Example #1
0
        private void JuliaSet_Click(object sender, EventArgs e)
        {
            JuliaSet j = new JuliaSet();

            j.ShowDialog();
            j.Dispose();
        }
Example #2
0
        public void mouseClickOnForm(object sender, MouseEventArgs e)
        {
            bool RunFunction = true;

            if (!IsConverterInitialized)
            {
                RunFunction = false;
            }
            if (!DrawJuliaSetEnabled.Checked)
            {
                RunFunction = false;
            }
            if (!ZoomInEnabled.Checked)
            {
                RunFunction = false;
            }
            if (!DrawJuliaSetEnabled.Checked && ZoomInEnabled.Checked)
            {
                RunFunction = true;
            }
            if (DrawJuliaSetEnabled.Checked && !ZoomInEnabled.Checked)
            {
                RunFunction = true;
            }

            if (RunFunction)
            {
                if (ZoomInEnabled.Checked)
                {
                    DrawJuliaSetEnabled.Checked = false;

                    double x_temp = Convert.ToDouble(e.X);
                    XCoord = x_temp;

                    double y_temp = Convert.ToDouble(e.Y);
                    YCoord = y_temp;

                    try
                    {
                        ZoomScale = Convert.ToInt16(ZoomScaleTextBox.Text);
                    }
                    catch (Exception c)
                    {
                        MBOX("Error: " + c.Message, "Error");
                    }
                    if (ZoomScale < 1)
                    {
                        MBOX("Zoom scale must be above 0");
                        ZoomScale             = 7;
                        ZoomScaleTextBox.Text = "7";
                        return;
                    }

                    ComplexNumber pixel_coordinate = new ComplexNumber((int)(XCoord - (BITMAP_WIDTH / (ZoomScale)) / 4),
                                                                       (int)(YCoord - (BITMAP_HEIGHT / (ZoomScale)) / 4));
                    ZoomCoordinate1 = Converter.GetAbsoluteMathsCoord(pixel_coordinate);
                }

                else if (DrawJuliaSetEnabled.Checked)
                {
                    ZoomInEnabled.Checked = false;
                    Cursor cursor  = new Cursor(Cursor.Current.Handle);
                    double x_pixel = Convert.ToDouble(e.X);
                    double y_pixel = Convert.ToDouble(e.Y);

                    ComplexNumber i = new ComplexNumber(x_pixel, y_pixel);
                    ComplexNumber screen_coordinates = Converter.GetAbsoluteMathsCoord(i);

                    JuliaSet j = new JuliaSet(screen_coordinates, Convert.ToInt32(this.ZExponentBox.Text));
                    j.ShowDialog();
                    j.Dispose();
                }
            }
        }