msasan1367
New member
- Joined
- May 26, 2011
- Messages
- 1
- Programming Experience
- Beginner
how to create 200 lines with random width?
I mean something like below picture:
Form.jpg - 4shared.com - photo sharing - download image
I have this code that just work with a button, but I need create 200 lines when I run C# program:
private void button1_Click(object sender, EventArgs e)
{
Random RandomClass = new Random();
int height = 1;
for (int i = 0; i < 200; i++)
{
height += 2;
int RandomNumber = RandomClass.Next(11, 111);
System.Drawing.Graphics my_graph = this.CreateGraphics();
Point my_point_one = new System.Drawing.Point(10, 2*(i+1));
Point my_point_two = new System.Drawing.Point(RandomNumber, 2 * (i + 1));
my_graph.DrawLine(System.Drawing.Pens.Blue, my_point_one, my_point_two);
my_graph.Dispose();
}
}
How do I do it?
I mean something like below picture:
Form.jpg - 4shared.com - photo sharing - download image
I have this code that just work with a button, but I need create 200 lines when I run C# program:
private void button1_Click(object sender, EventArgs e)
{
Random RandomClass = new Random();
int height = 1;
for (int i = 0; i < 200; i++)
{
height += 2;
int RandomNumber = RandomClass.Next(11, 111);
System.Drawing.Graphics my_graph = this.CreateGraphics();
Point my_point_one = new System.Drawing.Point(10, 2*(i+1));
Point my_point_two = new System.Drawing.Point(RandomNumber, 2 * (i + 1));
my_graph.DrawLine(System.Drawing.Pens.Blue, my_point_one, my_point_two);
my_graph.Dispose();
}
}
How do I do it?