Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            double   x, t, temp, xscale, yscale;
            Bitmap   map         = new Bitmap(pictureBox1.Width, pictureBox1.Height);
            Graphics mapGraphics = Graphics.FromImage(map);


            x0   = double.Parse(textBox1.Text, System.Globalization.CultureInfo.InvariantCulture);
            a0   = double.Parse(textBox2.Text, System.Globalization.CultureInfo.InvariantCulture);
            amax = double.Parse(textBox3.Text, System.Globalization.CultureInfo.InvariantCulture);
            b0   = double.Parse(textBox5.Text, System.Globalization.CultureInfo.InvariantCulture);
            bmax = double.Parse(textBox6.Text, System.Globalization.CultureInfo.InvariantCulture);

            xscale = (amax - a0) / pictureBox1.Width;
            yscale = (bmax - b0) / pictureBox1.Height;


            double x1 = 0, y1;

            for (double a = a0; a <= amax; a += xscale)
            {
                y1 = 0;
                for (double b = bmax; b >= b0; b -= yscale)
                {
                    x = x0; t = 0;
                    while (t <= 500)
                    {
                        if (x <= 100)
                        {
                            x = Function(x, a, b);
                        }

                        t++;
                    }

                    temp = x;

                    for (int i = 0; i < 16; i++)
                    {
                        if (x <= 100)
                        {
                            x = Function(x, a, b);
                            if (Math.Abs(temp - x) < 1e-5)
                            {
                                Metods.MapDrawing(mapGraphics, i, x1, y1, xscale, yscale);
                                break;
                            }
                        }
                        else
                        {
                            mapGraphics.FillRectangle(Brushes.White, (float)(x1 / (xscale)), (float)(y1 / (yscale)), 1, 1);
                        }
                    }
                    y1 += yscale;
                }
                x1 += xscale;
            }
            pictureBox1.Image = map;
        }
Beispiel #2
0
 public Form1()
 {
     InitializeComponent();
     Metods.numberToColor(pictureBox2);
     Metods.chartSettings(chart1);
 }