Ecco il codice:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; using System.Drawing; namespace Project10 { class mioForm:Form { Button[] bottone; public mioForm() { InitializeComponent(); } public static void Main() { mioForm frm = new mioForm(); Application.Run(frm); } private void InitializeComponent() { bottone = new Button[23]; this.SuspendLayout(); for (int n = 0; n < 23; n++) { bottone[n] = new Button(); bottone[n].Width = 50; bottone[n].Height = 50; bottone[n].Left = bottone[n].Width * (n % 5); bottone[n].Top = bottone[n].Height * (n / 5); bottone[n].Text = (n+1).ToString(); this.Controls.Add(bottone[n]); } this.ClientSize = new System.Drawing.Size(584, 561); this.Name = "mioForm"; this.Load += new System.EventHandler(this.mioForm_Load); this.ResumeLayout(false); this.PerformLayout(); } private void mioForm_Load(object sender, EventArgs e) { } } }Resta ancora da vedere come gestire l'evento Click di ciascuno dei controlli, altrimenti che ci faccio?
Per il momento, passo ad altro.
Nessun commento:
Posta un commento