Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Threading.Tasks;
  5. using System.Windows.Forms;
  6. using System.Drawing;
  7. namespace WindowsFormsApp1
  8. {
  9. static class Program
  10. {
  11. static void Main()
  12. {
  13. Form Form1 = new Form();
  14. Button[] B = new Button[10];
  15. int x = -20;
  16. Random r = new Random();
  17.  
  18. for (int k = 0; k < 9; k++)
  19. {
  20. x += 20;
  21. B[k] = new Button();
  22. B[k].Text = "Button #" + k+1;
  23. B[k].BackColor = Color.FromArgb(r.Next(0, 256), r.Next(0, 256), r.Next(0, 256));
  24. B[k].Location = new Point(0, x);
  25. Form1.Controls.Add(B[k]);
  26. B[k].Width = 100;
  27.  
  28. }
  29. Application.Run(Form1);
  30.  
  31. }
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement