Nie mogę edytować posta, więc dorzucam kod tutaj:
public void timer1_Tick(object sender, EventArgs e)
{
label1.Text = DateTime.Now.ToLongTimeString() + "," + DateTime.Now.ToLongDateString();
i = i + 0.01;
//0.05654866776461627829232758089903;
//pictureBox1.Refresh();
for (j = 0; j <= 50; j = j + 15)
{
x = Math.Round(Math.Sin(i) * (90)) + 120;
y = Math.Round(Math.Cos(i) * (90)) + 120;
x1=Math.Round(Math.Sin(i) * (90)) + 20;
y1 = Math.Round(Math.Cos(i) * (90)) + 20;
Dioda d1 = new Dioda(pictureBox1, Convert.ToInt32(x), Convert.ToInt32(y), x, y, i);
Dioda d2 = new Dioda(pictureBox1, Convert.ToInt32(x), Convert.ToInt32(y), x1, y1, i);
}
label2.Text = Convert.ToString(x);
label3.Text = Convert.ToString(y);
if (x == 30 )
{
k = k + 1;
}
label4.Text = Convert.ToString(k);
}
public Dioda(System.Windows.Forms.PictureBox _symulacjaPictureBox, int _Width, int _Height, double x, double y, double i,int g)
{
System.Drawing.Graphics grfx = _symulacjaPictureBox.CreateGraphics();
Pen pen = new Pen(Color.Red, g);
grfx.DrawEllipse(pen, Convert.ToInt32(x), Convert.ToInt32(y - 4), 5, 5);
// Draw line to screen.
// ...
}
@xeo545x39 wiem co jest powodem problemu, tylko nie wiem jak go rozwiązać :)