using System;
using System.Drawing;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Random rnd = new Random();
int x, y;
Color c = Color.FromArgb(rnd.Next(0, 255), rnd.Next(0, 255), rnd.Next(0, 255));
SolidBrush solidbrush = new SolidBrush(c);
Graphics g = this.CreateGraphics();
for (int i = 1; i < 10000; i++)
{
x = rnd.Next(1, 400);
y = rnd.Next(1, 300);
g.FillRectangle(solidbrush, x, y, 1, 1);
solidbrush.Color = Color.FromArgb(rnd.Next(0, 255), rnd.Next(0, 255), rnd.Next(0, 255));
}
solidbrush.Dispose();
g.Dispose();
}
}
}