Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.Drawing;
- namespace WindowsFormsApp1
- {
- static class Program
- {
- static void Main()
- {
- Form Form1 = new Form();
- Button[] B = new Button[10];
- int x = -20;
- Random r = new Random();
- for (int k = 0; k < 9; k++)
- {
- x += 20;
- B[k] = new Button();
- B[k].Text = "Button #" + k+1;
- B[k].BackColor = Color.FromArgb(r.Next(0, 256), r.Next(0, 256), r.Next(0, 256));
- B[k].Location = new Point(0, x);
- Form1.Controls.Add(B[k]);
- B[k].Width = 100;
- }
- Application.Run(Form1);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement