Jak ktoś moze to prosze o pomoc bo nie wiem gdzie błąd roie!
/*
* Created by SharpDevelop.
* User: le
* Date: 2008-12-03
* Time: 20:53
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace Le
{
/// <summary>
/// Description of MainForm.
/// </summary>
public partial class MainForm : Form
{
[STAThread]
public static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
public MainForm()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
//
// TODO: Add constructor code after the InitializeComponent() call.
//
}
void MainFormLoad(object sender, EventArgs e)
{
}
void RysujClick(object sender, EventArgs e)
{
int maxX=ekran.Width; //Wielkość ekranu do wyświetlania
int maxY=ekran.Height;
int i,j, kolor;
double amax,amin,bmax,bmin;
amax=double.Parse(Amax.Text);
amin=double.Parse(Amin.Text);
bmax=double.Parse(Bmax.Text);
bmin=double.Parse(Bmin.Text);
double a,b;
ekran.Image = new Bitmap(ekran.Width, ekran.Height);
Graphics graph = Graphics.FromImage(ekran.Image);
graph.FillRectangle(new SolidBrush(Color.White), 0, 0, ekran.Width, ekran.Height);
for(i=0;i<maxX;i++)
{
a=(amax-amin)/maxX*i+amin;
for(j=0;j<maxY;++j)
{
b=-(bmax-bmin)/maxY*j+bmax;
kolor=kolor_mandelbrota(a,b);
graph.DrawRectangle(new Pen(Color.FromArgb(kolor,255,255)), i, j, 1,1);
//ekran(i,j,kolor);
}
}
}
public int kolor_mandelbrota(double a, double b){
int i, imax=100;
double x,xx,y;
double r,rmax=2;
int kolor;
x=y=0;
for(i=0;i<imax;i++)
{
xx=(x*x)-(y*y)+a;
y=((2*x)*y)+b;
x=xx;
r=Math.Sqrt((x*x)+(y*y));
if(r<rmax)
break;
if(i==imax)
kolor=255;
else{
kolor=0;
}
return kolor;
}
}
}
}
albo powiedzcie jak zrobic program podobny