using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp5
{
public partial class Form1 : Form
{
int count = 0;
Random r = new Random();
int[] ar;//R,G,B,Y,Y
public Form1()
{
InitializeComponent();
}
private void Form1_Paint(object sender, PaintEventArgs e)
{
this.Text = count++.ToString();
int x1 = 400;
int y1 = 300;
int x2, y2;
for (int i = 0; i < 100; i++)
{
Pen pen = new Pen(Color.FromArgb(ar[i * 5], ar[i * 5 + 1], ar[i * 5 + 2]), 3);
x2 = x1 + ar[i * 5 + 3];
y2 = y1 + ar[i * 5 + 4];
e.Graphics.DrawLine(pen, x1, y1, x2, y2);
x1 = x2;
y1 = y2;
}
}
private void Form1_Load(object sender, EventArgs e)
{
ar = new int[500];//R,G,B,Y,Y
for (int i = 0; i < 100; i++)
{
ar[i * 5] = r.Next(256);
ar[i * 5 + 1] = r.Next(256);
ar[i * 5 + 2] = r.Next(256);
ar[i * 5 + 3] = r.Next(-100, 100);
ar[i * 5 + 4] = r.Next(-100, 100);
}
}
}
}