I'm attempting to write a program that displays an array of labels; however, I can't seen to make the labels appear in the form. I've set some of the properties, but still not luck. Any suggestions?
Code:using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace HangMan { public partial class Hangman : Form { Random r = new Random(); string[] a = {"Cleveland", "Oakland", "Detroit", "Tampa", "Seattle", "Portland", "Denver", "Phoenix", "Kent", "Hollywood", "Buffalo"}; string q = ""; Label[] label; int guessRight = 0; int guessWrong = 0; public Hangman() { InitializeComponent(); } private void Hangman_Load(object sender, EventArgs e) { int n = 0; q = a[n]; Guess.Visible = false; label = new Label[q.Length]; int c = 0; for (int i = 0; i < label.Length; i++) { label[i] = new Label(); label[i].AutoSize = true; label[i].Location = new Point(200 + c, 150); label[i].Font = Control.DefaultFont; label[i].ForeColor = Control.DefaultForeColor; label[i].BackColor = Control.DefaultBackColor; this.Controls.Add(label[i]); c += 57; } }



LinkBack URL
About LinkBacks


